From: Alban Hertroys <alban@magproductions.nl>
To: Benjamin Arai <benjamin@araisoft.com>
Cc: Shoaib Mir <shoaibmir@gmail.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: [GENERAL] OUTER JOIN IS SLOW
Date: Tue, 02 Jan 2007 11:57:36 +0100
Message-ID: <459A3AA0.4070307@magproductions.nl> (raw)
In-Reply-To: <458D9437.1000609@araisoft.com>
References: <458D8D56.6020506@araisoft.com>
<bf54be870612231217j67759788pbfc3f84ffd705fd2@mail.gmail.com>
<bf54be870612231221l515f33b5k39c455476de0db7c@mail.gmail.com>
<458D9437.1000609@araisoft.com>
Benjamin Arai wrote:
> Just to make things more clear I ran EXPLAIN ANALYZE on the slow query.
> I got
> -> Index Scan using mutualfd_weekday_qbid_pkey_idx on
> mutualfd_weekday_qbid (cost=0.00..6.01 rows=1 width=19) (actual
> time=34.579..8510.801 rows=253 loops=1)
> Index Cond: ((pkey >= '2005-12-15'::date) AND (pkey <=
> '2006-12-15'::date))
> Filter: (cusip = '92193920'::text)
This is the relevant part (including the index details). It's filtering
(text) over all index items within a period of a full year. I imagine
can be quite a lot of data (unless pkey is a primary key on a date
field; only 366 records).
As mentioned, ANALYZE helps, but you may want to check:
1) Are you comparing integers as text strings? You may not want to.
2) Do you have an index on cusip?
You probably have, just in case.
--
Alban Hertroys
alban@magproductions.nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //
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-admin@postgresql.org
Cc: alban@magproductions.nl, benjamin@araisoft.com, shoaibmir@gmail.com, pgsql-general@postgresql.org
Subject: Re: [GENERAL] OUTER JOIN IS SLOW
In-Reply-To: <459A3AA0.4070307@magproductions.nl>
References: <458D8D56.6020506@araisoft.com> <bf54be870612231217j67759788pbfc3f84ffd705fd2@mail.gmail.com> <bf54be870612231221l515f33b5k39c455476de0db7c@mail.gmail.com> <458D9437.1000609@araisoft.com> <459A3AA0.4070307@magproductions.nl>
* 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