PostgreSQL 8.0.0 �����ĵ���PostgreSQL �й� ������ | ||||
---|---|---|---|---|
Prev | Fast Backward | Fast Forward | Next |
һ�����ݿ����Ա������֪����"����ϵͳ���ڸ�ʲô�أ�"�� ����������λش�������⡣
��һЩ���߿�������������ݿ�Ļ�Լ��������ܡ� ���´��������������� PostgreSQL ��ͳ���ռ���(statistics collector)�� ������Ҳ���ܺ�����ͨ�� Unix ��س����� ps��top��iostat �� vmstat�� ͬ����һ�������ҳ���һ�����ܶ��ӵIJ�ѯ����ô���ǿ��ܻ�Ҫ�� PostgreSQL �� EXPLAIN �����һ�������� Section 13.1 �������� EXPLAIN ������������������ѯ����Ϊ�ķ�����
�ڴ����ƽ̨�ϣ�PostgreSQL �� ps �����������⣬�������Ǿͺ������ҳ�ij�����������̡�һ������ʾ����
$ ps auxww | grep ^postgres postgres 960 0.0 1.1 6104 1480 pts/1 SN 13:17 0:00 postmaster -i postgres 963 0.0 1.1 7084 1472 pts/1 SN 13:17 0:00 postgres: stats buffer process postgres 965 0.0 1.1 6152 1512 pts/1 SN 13:17 0:00 postgres: stats collector process postgres 998 0.0 2.3 6532 2992 pts/1 SN 13:18 0:00 postgres: tgl runbug 127.0.0.1 idle postgres 1003 0.0 2.4 6532 3128 pts/1 SN 13:19 0:00 postgres: tgl regression [local] SELECT waiting postgres 1016 0.1 2.4 6532 3080 pts/1 SN 13:19 0:00 postgres: tgl regression [local] idle in transaction
������ ps �ķ�����ͬ��ƽ̨�����в�ͬ����ʾ������ϸ��Ҳ��һЩ���������������һ������� Linux ϵͳ���� ������ʾ�����ĵ�һ������ʱ postmaster����������̡� ������ʾ�������������������ʱ���������һ���ġ� ������������ʵ��ͳ���ռ��������ǽ�����һ������ϸ�������� �������������ϵͳ������ͳ���ռ�������ô���Dz�����֡��� ʣ�µĽ���ÿ������һ�����������̣�ÿ������һ���ͻ������ӡ� ÿ�������Ľ��̶����������ʽ��������������ʾ��
postgres: user database host activity
�ڸÿͻ������ӵ��������У��û������ݿ⣬������Դ��������ֲ��䣬 ���ǻ�Ծ��ָʾ����仯����Ծ�Կ����� idle ��Ҳ����˵�� �ȴ��ͻ��˵������idle in transaction ����һ��BEGIN ����ȴ��û���������һ������������������ SELECT�� ͬ�������������Ŀǰ���ڵȴ�һ���������������̳��е�����ʱ�� ������Ϣ���渽�� waiting��������������У����ǿ����Ƴ������� 1003 ���ڵȴ� 1016��������� ��������ʩ��һЩ����������ʲô������
��ʾ: Solaris ��Ҫ�ر�Ĵ��� �����ʹ�� /usr/ucb/ps�������� /bin/ps���㻹����ʹ������ w ��־��������һ�������⣬��������� postmaster ʱ�õ����������� ps ״̬��ʾ�б���� ps ��ÿ��������������ʾ�Ķ̡����û���������������� ��ô ps Ϊÿ����������������Ľ�������� postmaster �������С�