Extra cost of "lossy mode" Bitmap Scan plan - Mailing list pgsql-hackers

From higepon
Subject Extra cost of "lossy mode" Bitmap Scan plan
Date
Msg-id f07386410904272233u452e1bf2n81b187f974fe5e81@mail.gmail.com
Whole thread Raw
Responses Re: Extra cost of "lossy mode" Bitmap Scan plan  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
List 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 :
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/


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Clean shutdown and warm standby
Next
From: Itagaki Takahiro
Date:
Subject: Re: Extra cost of "lossy mode" Bitmap Scan plan