the number of transactions in all tables in a database for a particular time. Means can we check how many insert/update/delete/select queries executed in each table in a database for a specific time period?
No. For one, deletes can/will be removed by vacuum statements. On the other hand, you can turn on the track_commit_timestamp feature (GUC). This will let you associate a timestamp to a specific commit. We use this in development. So that we can review EVERY OBJECT that changed (views, Procs, etc) over a period of time. It won't tell me HOW MANY times I saved that view. Or how many views I dropped (or even about Dropped Views). It's the closest concept I can think of.
Ok. But there must me something to check the excess load on the database for a particular time period
That is called monitoring and should throw alarms. And to observe statistics over a longer period you could use an extension called https://github.com/vyruss/pg_statviz You'd need pg_stat_activity enabled. Also https://github.com/darold/pgbadger is a good tool. Also auto_explain should be used to get explain from slow queries.
Pgbadger as I know logs the query response time. But I want to check the total transaction like insert update select in all tables of a database for a specific period for ex 1 hour.
Write your own stuff or give someone money to slow down your database. That's logging every single statement with all availability transaction information.
I would look at this from a different perspective: what do You consider an exess load on Your database? Usually, when We look at the data We can see that something isn’t right, presuming We know how data should look and grow. Just trying to find txcount doesn’t make much practical sense unless something is not behaving as it should. It is very hard for people here to give advice on such a broad topic.
I just wanted to know how we can check the number of inserts, update, and select query has been executed in 1 hour in a database?
You can do snapshots of pg_stat_statement with a cron job every hour, that thing has a counter for each query.
Обсуждают сегодня