是否有与SQL Server Profiler等效的PostgreSQL? [英] Is there a PostgreSQL equivalent of SQL Server profiler?

查看:388
本文介绍了是否有与SQL Server Profiler等效的PostgreSQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要查看提交到PostgreSQL服务器的查询。通常,我会使用SQL Server探查器在SQL Server领域中执行此操作,但是我尚未找到如何在PostgreSQL中执行此操作。似乎有很多付费工具,我希望有一个开放源代码的变种。

I need to see the queries submitted to a PostgreSQL server. Normally I would use SQL Server profiler to perform this action in SQL Server land, but I'm yet to find how to do this in PostgreSQL. There appears to be quite a few pay-for tools, I am hoping there is an open source variant.

推荐答案

您可以使用log_statement配置设置以获取到服务器的所有查询的列表

You can use the log_statement config setting to get the list of all the queries to a server

https://www.postgresql.org/docs/current/static/runtime-config-logging.html#guc-log-statement

只需进行设置,然后创建日志文件路径,您将获得列表。您还可以将其配置为仅记录长时间运行的查询。

Just set that, and the logging file path and you'll have the list. You can also configure it to only log long running queries.

然后您可以进行这些查询并对它们运行EXPLAIN来查找发生了什么事情。

You can then take those queries and run EXPLAIN on them to find out what's going on with them.

https://www.postgresql.org/docs/9.2/static/using -explain.html

这篇关于是否有与SQL Server Profiler等效的PostgreSQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆