From: Tom Lane <tgl@sss.pgh.pa.us>
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: Sat, 23 Dec 2006 20:55:55 -0500
Message-ID: <23901.1166925355@sss.pgh.pa.us> (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 <benjamin@araisoft.com> writes:
> -> 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)
Hm, so how many rows in mutualfd_weekday_qbid for that date?
And how many satisfy the cusip condition? (I suppose 253,
but it looks like that must be a very small fraction of all
the rows for that date.)
The selectivity estimators are not great about dealing with
zero-width intervals like this one (in fact, if you look at the
code you'll find it doesn't even bother to distinguish '>' from '>='
... something we should probably try to improve sometime).
You'd probably have better luck if you could fold the WHERE condition
down to "pkey = '2005-12-15'". Dunno how feasible that is for your
application.
regards, tom lane
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: tgl@sss.pgh.pa.us, benjamin@araisoft.com, shoaibmir@gmail.com, pgsql-general@postgresql.org
Subject: Re: [GENERAL] OUTER JOIN IS SLOW
In-Reply-To: <23901.1166925355@sss.pgh.pa.us>
References: <458D8D56.6020506@araisoft.com> <bf54be870612231217j67759788pbfc3f84ffd705fd2@mail.gmail.com> <bf54be870612231221l515f33b5k39c455476de0db7c@mail.gmail.com> <458D9437.1000609@araisoft.com> <23901.1166925355@sss.pgh.pa.us>
* 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