各类数据库中的SQL Profiler

 

 

     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功能已经可以使用了。

 



 


 

 

 


 

猜你喜欢

转载自soft-development.iteye.com/blog/1343568
今日推荐