各类数据库中的SQL Profiler

本文介绍了如何在PostgreSQL中利用PostgresEnterpriseManager和sql-profiler.dll实现SQLProfiler功能,以监控和优化SQL性能。重点包括配置postgresql.conf文件、加载SQLProfiler库、执行特定SQL脚本的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 

 

     SQL Profiling and Analysis

 

Most RDBMS experts agree that inefficient SQL code is the leading cause of most

database performance problems. The challenge for DBAs and developers is to locate the poorly-running SQL code in large and complex systems, and then optimize that code for better performance.

 

(1).SQL Server中已经自带了SQL Profiler功能

 

step1:

 
step2:

 
step3:

 

 

SQL Server 2008 中对SQL的监控相当简单,但PostgreSQL中想要有类似于SQL

Server中的此种功能却不是那么容易的。

 

 

(2)PostgreSQL中的SQL  Profiler的功能:

因为PostgreSQL没有自带的SQL  Profiler,但也提供了几种可能的实现方式.

具体的可参照http://www.enterprisedb.com/download-postgres-enterprise-manager

以下介绍的方式是:Postgres Enterprise Manager

但需要注意的是PostgreSQL server必须是8.4&above的版本,否则此种方式行不通。



 <!--[endif]-->

参照以上下载说明及安装说明,即满足基本环境。此时SQL ProfilerPostgres Enteripse Manager的菜单栏或menu中还是grey的,即禁用的!

<!--[if !supportLists]-->(1)   <!--[endif]-->PostgreSQL的目录中找到postgresql.conf文件,一般在data文件夹中,将#shared_preload_libraries =’’ 注释去掉(即去掉#),后将其值设置为:$libdir/sql-profiler.dll.就是加载lib目录下的sql-profiler.dll文件,使其具备SQL Profiler的功能!注意做完之后要重新启动。

<!--[if !supportLists]-->(2)   <!--[endif]-->之后要在执行SQL Profiler的数据库中执行sql-profiler.sql脚本才可以使用SQL Profiler的功能。改SQL脚本的位置一般在share\contrib\文件目录下.

做完这些,启动Postgres Enteripse Manager 发现执行了该脚本的数据库menu

SQL Profiler功能已经可以使用了。

 



 


 

 

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值