public inbox for [email protected]
help / color / mirror / Atom feedFrom: Jon Zeppieri <[email protected]>
To: Greg Sabino Mullane <[email protected]>
Cc: [email protected]
Subject: Re: Why a bitmap scan in this case?
Date: Thu, 19 Dec 2024 14:09:59 -0500
Message-ID: <CAKfDxxw-=_naXS-ypU9qWj8eNbAEJvGCy5ZxHA5HW=+M-baDcw@mail.gmail.com> (raw)
In-Reply-To: <CAKAnmmL327t5MRJ2uonQ3JB5bLegRbfa-WtpaTNBnbJ1iVef5Q@mail.gmail.com>
References: <CAKfDxxzqxm0gS44+4aUDejLq_iszqLJwR+EaM4x2pojrkV58eg@mail.gmail.com>
<CAKAnmmL327t5MRJ2uonQ3JB5bLegRbfa-WtpaTNBnbJ1iVef5Q@mail.gmail.com>
On Thu, Dec 19, 2024 at 1:39 PM Greg Sabino Mullane <[email protected]> wrote:
>>
>> Why wouldn't it do an index (or, really, an index only) scan in this case
>
>
> Well, it did do an index scan (and a bitmap scan is a pretty good solution here), but as to why no indexonly scan, there is probably not enough assurance that it won't have to hit the heap heavily anyway. Try doing a SET enable_bitmapscan=0; and re-run with EXPLAIN ANALYZE. If you see a large number of "Heap Fetches", that could be why. Vacuum the table and try again after doing SET enable_bitmapscan=1;
>
The table is freshly vacuumed. If I disable bitmap scans, it will do
an index only scan, which performs better. For the bitmap heap scan,
it says "Heap Blocks: exact=27393," whereas for the index only scan,
it's "Heap Fetches: 27701."
The row estimate is not good. The query estimates 317919 rows but
there are only 27701. There is some correlation here; if end_on is
null, start_on is a lot more likely to be recent, so maybe extended
statistics would be useful here.
- Jon
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Why a bitmap scan in this case?
In-Reply-To: <CAKfDxxw-=_naXS-ypU9qWj8eNbAEJvGCy5ZxHA5HW=+M-baDcw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox