Re: index-only-scan when there is an index on all columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Hadi Moshayedi <hadi(at)citusdata(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: index-only-scan when there is an index on all columns
Date: 2018-02-27 21:58:11
Message-ID: 28385.1519768691@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> If one runs vacuum on a table (small or otherwise) that is currently
> choosing an index scan as its best plan how likely is it that post-vacuum
> an index-only plan would be chosen if the index type and column presence
> conditions are met?

Offhand I think it would always prefer IOS over regular indexscan if the
table is mostly all-visible. The problem in this example was that other
choices dominate both.

> Also, I recall discussion that select statements will touch the visibility
> map (hence causing write I/O even in a read-only query) but [1] indicates
> that only vacuum will set them ddl will clear them.

Hm, I don't recall that, but I've not been involved in the last few rounds
of hacking on that mechanism.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-02-27 22:10:20 Re: index-only-scan when there is an index on all columns
Previous Message Tom Kazimiers 2018-02-27 21:40:32 Re: Unexpected behavior with transition tables in update statement trigger