Skip to content

Change the meaning of "tuples returned/s" #441

@kmoppel

Description

@kmoppel

Hi, hoping to kickstart a discussion on a thing that's bugging me for some years :D

In short - currently the "tuples returned/s" value is not really helpful at all for the following reasons:

  1. It does not show the actual row counts returned to the calling applications - what most developers assume.
  2. In instead shows only one side of the Postgres-internal tuple reading story - namely tup_returned, i.e. seq. scanned rows + scanned index entries, while ignoring the other side - tup_fetched, i.e. rows fetched by those scanned index entries.

Thus I think to improve the sitation would make sense to consider a combination of:

  1. Add "tup_fetched" to "tuples returned" the story
  2. Rename "tuples returned/s" to something like "tuples scanned/s"
  3. Start showing a new "rows returned/s" column based on pg_stat_statements.rows delta instead, when pg_stat_statements is available.

In any case the current "tuples returned" is just confusing for non-Postgres-guru users - for example below is a screenshot of app doing simple key read-write transactions, but were worried as "tuples returned" was very high still - indicating maybe some unwanted seq. scans, but most likely it's just caused by internal pg_class, pg_attribute etc access on query planning.

Image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions