Search Postgresql Archives

How to access insert/update counts for aborted subtransaction (or current transaction)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am working on adding some functionality to pgTAP, in order to detect unintended data modification side-effects.

The idea is to,
1. store the insert/update counts for all tables in a temporary table,
2. then run the test unit in a subtransaction,
3. then compare the new insert/update counts for all tables,
4. in addition to all the normal tests in the test unit, I will also keep a lookup table of how many inserts/updates to expect per table for each test unit.

I noticed pg_stat_clear_snapshot() doesn't affect pg_stat_get_tuples_inserted() within the same transaction.

Is there some other clever way of figuring out how many tuples were updated/inserted per table by the current transaction?

Alternatively, some way to force the top level transaction system to report the statistics for the current transaction?

I understand the clear benefits of making sure all the stat functions always return the same results in the same transaction, this is of course what you usually want to happen, but in my case I want the ability to override this.

Thankful for any ideas.

-- 
Best regards,

Joel Jacobson
Glue Finance

E: jj@xxxxxxxxxxxxxxx
T: +46 70 360 38 01

Postal address:
Glue Finance AB
Box  549
114 11  Stockholm
Sweden

Visiting address:
Glue Finance AB
Birger Jarlsgatan 14
114 34 Stockholm
Sweden

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux