| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: [PATCH] Partial indicies almost working (I think) |
| Date: | 2001-07-04 15:37:36 |
| Message-ID: | 27694.994261056@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> OK, so how to fix this. It seems to me that all that is required is that for
> partial indicies it should try to add a path for a plain index scan over the
> index and let the cost estimator decide if it's cheaper than a sequential
> scan.
Probably a reasonable first cut: if the index predicate fits, then always
generate a path. This assumes that partial indexes are usually made to
cover relatively small fractions of the table, but I'm willing to
believe that for starters.
> only thing is, will the cost estimator get it right. At least the partial
> index has an accurate count of the number of matching rows.
Why would you think that?
I can pretty much guarantee that the cost estimator will *not* get it
right --- it has no idea about partial indexes. You'll need to do some
fooling with the index selectivity estimation routines to account for
the effects of the predicate.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martín Marqués | 2001-07-04 15:42:59 | Re: TODO item |
| Previous Message | Marc SCHAEFER | 2001-07-04 15:36:52 | NOT IN issue |