From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <gsstark@mit.edu>
Cc: Alex Adriaanse <alex@innovacomputing.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Bad row estimates
Date: Sat, 04 Mar 2006 11:09:59 -0500
Message-ID: <14850.1141488599@sss.pgh.pa.us> (raw)
In-Reply-To: <87wtfasng0.fsf@stark.xeocode.com>
References: <4408E91C.90104@innovacomputing.com>
<87wtfasng0.fsf@stark.xeocode.com>
Greg Stark <gsstark@mit.edu> writes:
> (I don't think the end_ts in the index is buying you much, despite its
> appearance in the Index Cond in the plan.)
Well, it saves some trips to the heap, but the indexscan is still going
to run from the beginning of the index to start_ts = now(), because
btree has no idea that there's any correlation between the two index
columns.
If you could put some a-priori bound on the interval width, you could
add a WHERE constraint "AND now() - max_width <= start_ts", which'd
constrain the index scan and possibly also get you a better planner
estimate. Otherwise I think you really need a special datatype for time
intervals and a GIST or r-tree index on it :-(.
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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, gsstark@mit.edu, alex@innovacomputing.com
Subject: Re: Bad row estimates
In-Reply-To: <14850.1141488599@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