Re: Any way to see what queries are currently running?

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

 



You could try the following query after enabling the
stats_command_string parameter in the postgresql.conf file:-

-- displays current activity in the database
-- postgresql.conf parameter stats_command_string populates the
current_query -- column


select 	datid, 

	datname as "DB Name", 

	substr(procpid,1,6) as "Procpid", 

	substr(usesysid,1,5), 

	usename, 

	current_query as SQL, 

	query_start

from 

	pg_stat_activity

order by 

	procpid

On 8/16/05, Chris Hoover <revoohc@xxxxxxxxx> wrote:
> I'm running 7.3.4.  Is there anyway to see the actual sql being run by
> the database via a query?  I am having some problems with long running
> load causing querires from our reporting system.  I have sql logging
> turned on to log the sql statements to my postgres.log file.  However,
> these reporting queries do not appear to be logging the entire query.
> I am only getting the select clause (and I'm not sure if it's all of
> it) but no from or where clause.
> 
> Can I pull these queries out from postgres?
> 
> Thanks,
> 
> Chris
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux