Re: Why does query planner choose slower BitmapAnd ?

From: Seamus Abshere <seamus(at)abshere(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Why does query planner choose slower BitmapAnd ?
Date: 2016-02-22 18:14:56
Message-ID: 1456164896.1017903.528502994.5CC3B499@webmail.messagingengine.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 22, 2016, at 02:53 PM, Seamus Abshere wrote:
> On Mon, Feb 22, 2016, at 02:49 PM, Tom Lane wrote:
> > Seamus Abshere <seamus(at)abshere(dot)net> writes:
> > > Inspired, I changed cpu_index_tuple_cost to 0.1 (default: 0.005). It "fixed" my problem by preventing the BitmapAnd.
> > > Is this dangerous?
> >
> > Use a gentle tap, man, don't swing the hammer with quite so much abandon.
> > I'd have tried doubling the setting to start with. Raising it 20X might
> > cause other queries to change behavior undesirably.
>
> Doubling it was enough :)

name | setting | boot_val
------------------------------+---------+----------
cpu_index_tuple_cost | 0.09 | 0.005 <- 18x boot val, 9x
cpu_tuple_cost
cpu_operator_cost | 0.0025 | 0.0025
cpu_tuple_cost | 0.01 | 0.01

In the end I'm back to the big hammer.

I found that larger cities (e.g., more results from the city index)
required a larger cpu_index_tuple_cost to prevent the BitmapAnd.

Now cpu_index_tuple_cost is set to 0.09, which is 18x its boot_val and
9x cpu_tuple_cost... which seems strange.

Logically, should I be changing cpu_operator_cost instead?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message CS DBA 2016-02-22 19:08:09 decoding BLOB's
Previous Message Seamus Abshere 2016-02-22 17:53:38 Re: Why does query planner choose slower BitmapAnd ?