From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | depesz(at)depesz(dot)com |
Cc: | Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Problem with planner |
Date: | 2011-08-09 21:18:38 |
Message-ID: | 13004.1312924718@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
hubert depesz lubaczewski <depesz(at)depesz(dot)com> writes:
> I solved the problem by adding "enable_bitmapscan = false" (and keeping
> the query in original format, with subselect) which caused the plan to
> be ok.
I doubt that solution is any more robust than what you had before ---
in particular, it's likely to fall back to seqscans.
> but I'm much more interested to understand why pg chooses *not* to use
> index which is tailored specifically for the query - it has exactly
> matching where clause, and it indexes the column that we use for
> comparison.
Because the planner thinks it will have to pull a huge number of rows
from the index. Whether the index is "tailored" for the query
is irrelevant if it looks more expensive to use than a seqscan.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Postgres User | 2011-08-09 22:57:46 | Indicating DEFAULT values in INSERT statement |
Previous Message | hubert depesz lubaczewski | 2011-08-09 21:05:57 | Re: Problem with planner |