From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
---|---|
To: | Benjamin Arai <benjamin(at)araisoft(dot)com> |
Cc: | Shoaib Mir <shoaibmir(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org |
Subject: | Re: [GENERAL] OUTER JOIN IS SLOW |
Date: | 2007-01-02 10:57:36 |
Message-ID: | 459A3AA0.4070307@magproductions.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
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(at)magproductions(dot)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 //
From | Date | Subject | |
---|---|---|---|
Next Message | ashok@kalculate.com | 2007-01-02 12:04:46 | Invalid page header in block 211 of relation |
Previous Message | Tom Lane | 2007-01-02 02:42:14 | Re: pg_restore: [archiver (db)] could not execute query: ERROR: zero-length delimited identifier at or near """" at character 60 |
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Peterson | 2007-01-02 13:26:03 | Re: regular expression limit |
Previous Message | Richard Huxton | 2007-01-02 10:00:39 | Re: Backup Restore |