gotchasqlMajor
Difference between fetched and returned tuples in postgresql
Viewed 0 times
postgresqlreturnedfetcheddifferencebetweenandtuples
Problem
I'm facing a hard time trying to figure it out some performance problems in my database. I'm using a bunch of resources online to learn what to monitor and how to interpret that information.
From the above, I'm unable to find a clear explanation of what is the difference between
In pgAdmin4, there is a beautiful chart called "Tuples out" where these two concepts are contrasted, but I don't know how to interpret the info. In the official documentation only says that:
What exactly does "fetched" and "returned" mean?
I'm using postgresql 10.
From the above, I'm unable to find a clear explanation of what is the difference between
pg_stat_database.tup_returned and pg_stat_database.tup_fetched. In pgAdmin4, there is a beautiful chart called "Tuples out" where these two concepts are contrasted, but I don't know how to interpret the info. In the official documentation only says that:
tup_returned: Number of rows returned by queries in this database
tup_fetched: Number of rows fetched by queries in this database
What exactly does "fetched" and "returned" mean?
I'm using postgresql 10.
Solution
If you do
I can't see I've ever found these fields useful for diagnosing performance problems. Find your slow query and do an
select count(*) from million_row_table, one million row wills be returned, but only one row will be fetched.I can't see I've ever found these fields useful for diagnosing performance problems. Find your slow query and do an
EXPLAIN (ANALYZE, BUFFERS) of it.Context
StackExchange Database Administrators Q#218928, answer score: 37
Revisions (0)
No revisions yet.