Learn VisualLearn DB

Cover Columns and Check Visibility

An Index Only Scan is possible when the index can return every required column. PostgreSQL must also know that matching heap pages contain only visible tuples; otherwise it visits the heap for visibility. For example, a missing path column forces a heap visit, while adding INCLUDE (path) covers it as payload without making it a search key.

GOAL

State the two conditions needed to avoid heap fetches.

What does INCLUDE (path) change?