Gj’s SQL blog

April 19, 2009

how to speed up index on bytea, text, etc.

Filed under: index, postgresql — Grzegorz Jaskiewicz @ 5:43 pm

Well,

I recently had to create db to store some binary information. Now, these entries were to be unique in their category.

Average size of bytea field was to be 2400 bytes (about 2kb). Everything was fine, until table filled with 1.3M unique entries, and I was really astound how slow insertion become.

(more…)

Advertisements

on using different types in joins, and performance of it

Filed under: index, joins, postgresql — Grzegorz Jaskiewicz @ 4:44 pm

I get this question quite often from folks I work with, or people I join in their projects, usually with database designed by someone who is not very experienced in database world.

Most of them, don’t understand why the hell I am pressing for using bigint/int as a key to a table.

Here’s simple example, and my own theory behind it.

(more…)

The power of Views

Filed under: postgresql, views — Grzegorz Jaskiewicz @ 11:52 am

So, views.

What are they useful for?  how can we utilize such a power of views ?

(more…)

Unions and order

Filed under: postgresql, unions — Grzegorz Jaskiewicz @ 2:45 am

Quick note, on something that might save you few minutes.

It’s about UNION [ALL]. And why you should never assume order of output to be predetermined by order of tables in query.

(more…)

Welcome!

Filed under: postgresql — Grzegorz Jaskiewicz @ 2:20 am

Welcome!

I decided to document at least some attempts with SQL here.

I will mainly talk about PostgreSQL, because that’s what I use.

(more…)

Create a free website or blog at WordPress.com.