Re: general table stats, ideas ?

From: Mark Roberts <mailing_lists(at)pandapocket(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: general table stats, ideas ?
Date: 2008-10-07 17:27:56
Message-ID: 1223400476.12105.517.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> My problem is, I need to benchmark set of tables, where - we can
> assume - schema of each table is unknown, and we have no assumption on
> any fields being present there. (altho, if there is no other way to do
> it, we could assume id bigint not null default nextval('someseq'));
> basically, I need to know when certain row was selected (read), and
> when it was updated/created (insert). For that I need two fields. And
> although former could be done, and I more or less know how to do it (I
> think it can be done with rule, and default = now()) - I have yet to
> find a way on how to do the same thing for select.

So basically you've got a slony replicated database that you want to
check (on a row by row level) when something gets read/inserted/deleted?

It seems like you would want to add three fields to each table:
last_read_time, last_update_time, and original_insert_time

Then you restrict all access to the table and use security definer
functions to allow access. These functions would also update said
metadata to the table. If you need an ongoing log of access to the
tables, you could always add an accessor log table that looked like:

User (postgres/MYUSER) / Action (Select/Update/Insert) / Column
(some_column_name) / New Value (blah-value)

Erm, that's if I understand your question right. :-/

-Mark

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua Drake 2008-10-07 17:46:26 Pg Conference: West, bigger than last year!
Previous Message Gerfried Fuchs 2008-10-07 17:11:56 Re: [Pkg-postgresql-public] Postgres major version support policy on Debian