From: David Teran <david.teran@cluster9.com>
To: Shridhar Daithankar <shridhar_daithankar@myrealbox.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: optimizing Postgres queries
Date: Mon, 5 Jan 2004 13:05:03 +0100
Message-ID: <64C8DBBA-3F77-11D8-A528-000A95A6F0DC@cluster9.com> (raw)
In-Reply-To: <200401051705.55120.shridhar_daithankar@myrealbox.com>
References: <4B0023AC-3F72-11D8-B3EB-000A95A6F0DC@cluster9.com>
<200401051705.55120.shridhar_daithankar@myrealbox.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: david.teran@cluster9.com, shridhar_daithankar@myrealbox.com
Subject: Re: optimizing Postgres queries
In-Reply-To: <64C8DBBA-3F77-11D8-A528-000A95A6F0DC@cluster9.com>
References: <4B0023AC-3F72-11D8-B3EB-000A95A6F0DC@cluster9.com> <200401051705.55120.shridhar_daithankar@myrealbox.com> <64C8DBBA-3F77-11D8-A528-000A95A6F0DC@cluster9.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox