Index only scans

In PostgreSQL 9.2 a new performance feature was added: index-only scans. In a case where all the columns in a query are part of an index, the planner selects index-only-scans instead of index scans. Normally PostgreSQL accesses the index and underlying table too, but in some cases it appears unnecessary. If all the columns can be retrieved from the index then why look at the underlying table; index-only-scans avoid this unnecessary lookup. Avoiding unnecessary lookup gives significant performance enhancement. Here is an example: