From: David Witham <davidw@unidial.com.au>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Index question
Date: Fri, 13 Feb 2004 16:58:32 +1100
Message-ID: <CFA248776934FD43847E740E43C346D199DBF0@ozimelb03.ozicom.com> (raw)
There are 18321 records for 20040127 and so the estimate of 8839 for the = case is low but it still does the right thing.
There are 227197 records between '20040127' and current_date so the estimate in the >= case is accurate but the estimate for the between case is an order of magnitude too low. However, it used the index I wanted and the >= case didn't.
Regards,
David
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Friday, 13 February 2004 16:38
To: David Witham
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Index question
"David Witham" <davidw@unidial.com.au> writes:
> I understand that selecting count(*) will involve a scan at some
> stage, but I was surprised that the index wasn't used in the >= case,
> but was used in the between case.
Given the estimated row counts in your examples, the planner's choices
are not surprising. You have not given us any information on whether
those estimates are accurate.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: davidw@unidial.com.au, tgl@sss.pgh.pa.us
Subject: Re: Index question
In-Reply-To: <CFA248776934FD43847E740E43C346D199DBF0@ozimelb03.ozicom.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