Re: optimizing Postgres queries - Mailing list pgsql-performance

From David Teran
Subject Re: optimizing Postgres queries
Date
Msg-id 64C8DBBA-3F77-11D8-A528-000A95A6F0DC@cluster9.com
Whole thread Raw
In response to Re: optimizing Postgres queries  (Shridhar Daithankar <shridhar_daithankar@myrealbox.com>)
Responses Re: optimizing Postgres queries
Re: optimizing Postgres queries
List pgsql-performance
Hi Shridhar,

> Are you sure you are using correct data types on indexes?
>
Did not know about this...

> e.g. if field1 is an int2 field, then following query would not use an
> index.
>
our fk have the type bigint, when i try one simple select like this:

explain analyze SELECT --columns-- FROM KEY_VALUE_META_DATA t0 WHERE
t0.ID_FOREIGN_TABLE = 21110;

i see that no index is being used whereas when i use

explain analyze SELECT --columns-- FROM KEY_VALUE_META_DATA t0 WHERE
t0.ID_FOREIGN_TABLE = 21110::bigint;

an index is used. Very fine, the performance is about 10 to 100 times
faster for the single select.

I am using WebObjects with JDBC. I will now create a DB with integer
instead of bigint and see how this performs.

regards David


pgsql-performance by date:

Previous
From: Shridhar Daithankar
Date:
Subject: Re: optimizing Postgres queries
Next
From: Shridhar Daithankar
Date:
Subject: Re: optimizing Postgres queries