Re: Postgres 11 chooses seq scan instead of index-only scan

From: Don Seiler <don(at)seiler(dot)us>
To: twoflower <standa(dot)kurik(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres 11 chooses seq scan instead of index-only scan
Date: 2019-01-24 15:06:14
Message-ID: CAHJZqBBK_dMM6FAxb59nEaWNn_fk-i9_em4kQ6svFwje+K4DXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 24, 2019 at 9:01 AM twoflower <standa(dot)kurik(at)gmail(dot)com> wrote:

> Yes! That was it, after running VACUUM TABLE history_translation, the
> query is now executed using index-only scan.
>
> I was under the impression that ANALYZE TABLE history_translation is
> enough, but it is not.
>

Only a VACUUM will update the visibility map.
https://www.postgresql.org/docs/current/storage-vm.html

I used to think the same, that ANALYZE was enough, coming from an Oracle
background. I learned later that the visibility map isn't just used to
determine what to vacuum, but it is used by the optimizer/planner when
evaluating execution plans.

--
Don Seiler
www.seiler.us

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-01-24 15:07:07 Re: [pgbackrest] Expiring the last backup?
Previous Message Geoff Winkless 2019-01-24 15:05:35 Re: Casting Integer to Boolean in assignment