From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Greg Stark <gsstark(at)mit(dot)edu> |
Cc: | Alex Adriaanse <alex(at)innovacomputing(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Bad row estimates |
Date: | 2006-03-04 16:09:59 |
Message-ID: | 14850.1141488599@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Greg Stark <gsstark(at)mit(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2006-03-04 18:11:13 | Re: Bad row estimates |
Previous Message | Jim C. Nasby | 2006-03-04 15:46:05 | Re: Bad row estimates |