gotchasqlModerate
Difference between idx_tup_read and idx_tup_fetch on Postgres
Viewed 0 times
postgresidx_tup_readdifferenceidx_tup_fetchbetweenand
Problem
On Postgres 8.4 when you do:
It returns the fields idx_tup_read and idx_tup_fetch, what is the difference?
select * from pg_stat_all_indexes where relname = 'table_name';It returns the fields idx_tup_read and idx_tup_fetch, what is the difference?
Solution
When looking at the source code of the view, then you'll see that
The manual describes the two functions as follows:
pg_stat_get_tuples_returned(oid)
Number of rows read by sequential scans when argument is a table, or number of index entries returned when argument is an index
pg_stat_get_tuples_fetched(oid)
Number of table rows fetched by bitmap scans when argument is a table, or table rows fetched by simple index scans using the index when argument is an index
idx_tup_read is the result of calling pg_stat_get_tuples_returned() and idx_tup_fetch is the result of calling pg_stat_get_tuples_fetched()The manual describes the two functions as follows:
pg_stat_get_tuples_returned(oid)
Number of rows read by sequential scans when argument is a table, or number of index entries returned when argument is an index
pg_stat_get_tuples_fetched(oid)
Number of table rows fetched by bitmap scans when argument is a table, or table rows fetched by simple index scans using the index when argument is an index
Context
StackExchange Database Administrators Q#17863, answer score: 17
Revisions (0)
No revisions yet.