1

Postgres has new release 9.6 - I have read the docs about the index-only scan. I'm aware of postgres tables' heap, and I know how partial indexes(or indexes in general) work. I just don't understand the benefit of index-only.

Questions

  • What really changed? Didn't we used index only scan already?
  • How and when should I use them to get the best benefits?

non related background: I'm dealing with tables with 6B rows with a lot of INSERTs and SELECTs in production environments

1 Answer 1

6

Quote from the release notes

Allow use of an index-only scan on a partial index when the index's WHERE clause references columns that are not indexed

(emphasis mine)

So in 9.5 and before the following index could not be used for an index only scan:

create index on foo (col1, col2)
   where col3 = 42;

Because col3 wasn't part of the indexed columns. This has changed in 9.6

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.