From: | higepon <higepon(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Extra cost of "lossy mode" Bitmap Scan plan |
Date: | 2009-04-28 05:33:54 |
Message-ID: | f07386410904272233u452e1bf2n81b187f974fe5e81@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 : we may add some extra costs to total costs */
}
Any ideas how to do this?
Best regards,
-----
MINOWA Taro (Higepon)
Cybozu Labs, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Itagaki Takahiro | 2009-04-28 06:00:27 | Re: Extra cost of "lossy mode" Bitmap Scan plan |
Previous Message | Heikki Linnakangas | 2009-04-28 05:30:08 | Re: Clean shutdown and warm standby |