Hi.
I found the current planner doesn't care about "lossy mode" on Bitmap Scan.
I think costs of following two plans are equal now.
(a) Having enough work_mem => normal Bitmap Scan.
(b) Having less work_mem than estimated rows => Bitmap Scan with "lossy mode". Slower than (a).
So, sometimes the planner makes a wrong choice.
For example, on some queries the planner doesn't choose a faster Index Scan plan
but a much slower Bitmap Scan (in actually lossy).
My understanding is that we can know whether the plan is lossy or not
like following.
int tbm_maxentries = work_mem * 1024L;if (estimatedNumLows < tbm_maxentries) { /* not lossy */} else { /* lossy :
wemay add some extra costs to total costs */}
Any ideas how to do this?
Best regards,
-----
MINOWA Taro (Higepon)
Cybozu Labs, Inc.
http://www.monaos.org/
http://code.google.com/p/mosh-scheme/