Databases · Middle · Question 14 of 75

Why can SELECT COUNT(*) FROM big_table be slow in PostgreSQL?

Explanation

If an approximate number is enough, read the estimate from pg_class.reltuples, or keep a counter updated by the application or a trigger.

Further reading

Problem with a question

Databases · Middle · question 14

Test yourself

Take the Databases · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz