Find all the the SELECT statements that occured

Started by Nik Tekalmost 13 years ago3 messagesgeneral
Jump to latest
#1Nik Tek
niktek2005@gmail.com

Hi,

I have a question on how to find all the SELECT statements that have
occurred in the database. I don't want any DML(Insert/Update/Delete)
statements to be captured. This is for knowing how many selects statements
occur within the database in an 1 hour interval or on a average.

Would this simple or possible in postgres?

Thank you
Nik

#2Steve Crawford
scrawford@pinpointresearch.com
In reply to: Nik Tek (#1)
Re: Find all the the SELECT statements that occured

On 05/23/2013 02:37 PM, Nik Tek wrote:

Hi,

I have a question on how to find all the SELECT statements that have
occurred in the database. I don't want any DML(Insert/Update/Delete)
statements to be captured. This is for knowing how many selects
statements occur within the database in an 1 hour interval or on a
average.

If you are looking for statistical information you should probably look
at PgBadger. You can see the by-hour counts of select, update, delete,
etc. as well as long-running queries, queries that are run most
frequently, queries that consume the most overall time and much more.

Cheers,
Steve

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Sergey Konoplev
gray.ru@gmail.com
In reply to: Nik Tek (#1)
Re: Find all the the SELECT statements that occured

On Thu, May 23, 2013 at 2:37 PM, Nik Tek <niktek2005@gmail.com> wrote:

I have a question on how to find all the SELECT statements that have
occurred in the database. I don't want any DML(Insert/Update/Delete)
statements to be captured. This is for knowing how many selects statements
occur within the database in an 1 hour interval or on a average.

Would this simple or possible in postgres?

Take a look at the pg_stat_statements module.

http://www.postgresql.org/docs/9.2/static/pgstatstatements.html

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

Profile: http://www.linkedin.com/in/grayhemp
Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979
Skype: gray-hemp
Jabber: gray.ru@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general