Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been experiencing some very slow queries for a specific table. This table grows daily. I ran the pg_relation_size function, which gives the size of a table in the database:

mydb=# select pg_relation_size('reports');
(1 row)

Now I assume the return value is in bytes. So if I wanted gigabyte size, then this is basically saying 10.3 gigabytes. Could a table that is in 10 gigabytes in size really reduce the performance of queries against that table?

share|improve this question
Do you run vacuum on your table regularly. That will garbage collect and reclaim storage. More info here – clement Mar 9 '14 at 6:54
How many rows does the table have? And what is the definition of the table? What kind of columns does it contain? – a_horse_with_no_name Mar 9 '14 at 8:15
pg_size_pretty(pg_relation_size('reports')) for human readable. Table size vs query performance depends on indexes, clustering, query patterns, and more; show explain analyze for queries you're concerned about. Also make sure the table isn't bloated (see vacuum documentation, postgresql wiki on routine vacuuming). – Craig Ringer Mar 9 '14 at 8:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.