Explain with buffer counts

These examples should have proven to you that looking at the counts of blocks hit and read is valuable for determining whether a query plan is really being executed correctly or not. PostgreSQL 9.0 adds a feature to make this easier than before. Rather than looking at the pg_stat* data as done in the preceding example, you can request a count of buffers accessed directly when running EXPLAIN:

To see how well this works, try running that query again after dropping the index that's selective on v:

That shows the sequential scan running against the full 443 pages of data this table is known to occupy, instead of the much smaller count the earlier query executed in.