postgresql - Postgres: Best way to determine changes in table without scanning entire table -


i designing etl take incremental changes postgres table.

how detect whether table rows modified after last etl run without doing full table scan ?

i'd save stats , compare pg_stat_all_tables that, eg ran sequentially:

t=# select schemaname,relname,n_tup_ins,n_tup_upd,n_tup_del pg_stat_all_tables relname = 'rapid_inserts';  schemaname |      relname       | n_tup_ins | n_tup_upd | n_tup_del ------------+--------------------+-----------+-----------+-----------  public     | rapid_inserts| 254681563 |         0 |         0 (1 row)  time: 10.921 ms t=# select schemaname,relname,n_tup_ins,n_tup_upd,n_tup_del pg_stat_all_tables relname = 'rapid_inserts';  schemaname |      relname       | n_tup_ins | n_tup_upd | n_tup_del ------------+--------------------+-----------+-----------+-----------  public     | rapid_inserts| 254681569 |         0 |         0 (1 row)  time: 10.980 ms 

it means 6 rows inserted in barely second. same work updates , deletes...


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -