Sequences vs statistics

From: Herbey Eric Zepeda <ehzepeda(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Sequences vs statistics
Date: 2013-10-29 03:16:47
Message-ID: CAE7DxbZ4oXo7S4g_QpYNX3U1WhD2hQBXVqa6HZPa6oud8OvwFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi, I'm in the process of deciding whether to use.

-1 sequence per table containing the number of rows
-Using the collected statistics and functions like pg_relation_size

This is my use case:

I have several hundred tables in one database that I would like to
constantly monitor as far as size or number of records.

When a certain threshold is met, I will not allow any further inserts
into that table.
The threshold-met-event can be approximate.

How will I affect the performance of the server if I chose to query
for the system statistics data say, every 5 seconds as opposed to
just reading the latest_value of a sequence that gets updated every time
a row is added to its corresponding table?

Thank you

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David Johnston 2013-10-29 03:56:29 Re: Sequences vs statistics
Previous Message Tom Lane 2013-10-28 22:59:11 Re: displaying UTC time in local time