RH7.1的性能问题 [英] Performance problem on RH7.1

查看:53
本文介绍了RH7.1的性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我对生产环境的性能有问题。

我有两个数据库服务器。一台在我的笔记本电脑上(2Ghz,1GB,WinXP,Cygwin,
Postgres 7.3.4)和一台在生产服务器上(2GHz,1GB,Ultra SCSI,

RH7 .1,Postgres 7.3.2)。

我在两台计算机上运行相同的转储和相同的查询。

差异很大。

查询在生产服务器上的时间比在笔记本电脑上长5倍。


什么可以是原因?有人可以给我一些建议吗?

提前告知你。


祝你好运,

- CsabaEgyüd

linux服务器上的内核参数:

------------------------------- -------

[root @db kernel] #pwd

/ proc / sys / kernel

[root @ db kernel ] #cat shmall shmmax

134217728

134217728

[root @db kernel]#

查询:

----------

解析分析选择

id,artnum,oldartnum,name,munitid,getupid,vtsz,增值税,描述,

getupquantity,minstock,

(从t_prices选择数量(*),其中t_prices.productid = t_products.id)为

pcount,

round(get_stock(id,1):: numeric,2)as stockm,

round(get_stock_getup(id,1):: numeric,2)as stockg,

(从t_munits中选择id = munitid的缩写)作为munit,

(选择get_order_getup(id))作为deliverygetup,

(选择(从t_or中选择deliverydate ders where id = orderid)

deliverydate

from t_orderdetails

其中productid = t_products.id和

not not (选择从t_orders交付,其中id = orderid)限制1)as

deliverydate,

(从t_getups中选择id = getupid的缩写)作为getup

来自t_products

来自artnum的订单;


我的笔记本电脑上的QUERY PLAN:

-------- ----------------

排序(成本= 70.17..72.38行= 885宽度= 184)(实际时间= 7264.00..7264.00
行= 885循环= 1)

排序键:artnum

- > seq扫描t_products(成本= 0.00..26.85行= 885宽度= 184)(实际

时间= 21.00..7259.00行= 885循环= 1)

SubPlan

- >聚合(成本= 28.62..28.62行= 1宽度= 0)(实际

时间= 0.12..0.12行= 1个循环= 885)

- >在t_prices上使用t_prices_productid进行索引扫描

(成本= 0.00..28.60行= 8宽度= 0)(实际时间= 0.05..0.10行= 2个循环= 885)

指数条件:(productid = $ 0)

- > seq扫描t_munits(成本= 0.00..1.06行= 1宽度= 32)

(实际时间= 0.02..0.02行= 1循环= 885)

过滤:(id = $ 1)

- >结果(成本= 0.00..0.01行= 1宽度= 0)(实际

时间= 1.13..1.13行= 1个循环= 885)

- >限制(成本= 0.00..149.06行= 1宽度= 4)(实际

时间= 0.09..0.09行= 0循环= 885)

- > seq扫描t_orderdetails(成本= 0.00..149.06行= 1

宽度= 4)(实际时间= 0.08..0.08行= 0循环= 885)

过滤:((productid = $ 0)AND(NOT(subplan)))

SubPlan

- > seq扫描t_orders(成本= 0.00..1.27行= 1

宽度= 14)(实际时间= 0.00..0.00行= 1个循环= 107)

过滤:(id = $ 2)

- > Seq扫描t_orders(成本= 0.00..1.27行= 1

宽度= 1)(实际时间= 0.02..0.03行= 1个循环= 107)

过滤:(id = $ 2)

- > seq扫描t_getups(成本= 0.00..1.16行= 1宽度= 32)

(实际时间= 0.01..0.02行= 1循环= 885)

过滤:(id = $ 3)

总运行时间:7265.00毫秒


生产服务器上的QUERY PLAN:

---- --------------------------------

排序(费用= 70.17..72.38行= 885宽度= 121)(实际时间= 36729.92..36730.18

行= 885循环= 1)

排序键:artnum

- > ; seq扫描t_products(成本= 0.00..26.85行= 885宽度= 121)(实际

时间= 45.16..36724.73行= 885循环= 1)

SubPlan

- >聚合(成本= 9.06..9.06行= 1宽度= 0)(实际

时间= 0.15..0.15行= 1个循环= 885)

- >在t_prices上使用t_prices_productid进行索引扫描

(成本= 0.00..9.05行= 2宽度= 0)(实际时间= 0.12..0.14行= 2个循环= 885)

指数条件:(productid = $ 0)

- > seq扫描t_munits(成本= 0.00..1.06行= 1宽度= 5)(实际

时间= 0.04..0.04行= 1个循环= 885)

过滤:(id = $ 1)

- >结果(成本= 0.00..0.01行= 1宽度= 0)(实际

时间= 0.80..0.80行= 1个循环= 885)

- >限制(成本= 0.00..149.06行= 1宽度= 4)(实际

时间= 0.08..0.08行= 0循环= 885)

- > seq扫描t_orderdetails(成本= 0.00..149.06行= 1

宽度= 4)(实际时间= 0.07..0.08行= 0循环= 885)

过滤:((productid = $ 0)AND(NOT(subplan)))

SubPlan

- > Seq扫描t_orders(成本= 0.00..1.27行= 1

宽度= 14)(实际时间= 0.01..0.02行= 1个循环= 107)

过滤:(id = $ 2)

- > seq扫描t_orders(成本= 0.00..1.27行= 1

宽度= 1)(实际时间= 0.01..0.02行= 1个循环= 107)

过滤:(id = $ 2)

- > seq扫描t_getups(成本= 0.00..1.16行= 1宽度= 11)

(实际时间= 0.03..0.04行= 1循环= 885)

过滤:(id = $ 3)

总运行时间:36730.67毫秒

---

外发邮件已通过无病毒验证。

由AVG反病毒系统检查( http://www.grisoft.com)

版本:6.0.707 /病毒库:463 - 发布日期:2004。06. 15.


------- --------------------(广播结束)------------------------- -

提示8:解释分析是你的朋友

Hi All,
I''ve a problem with the perfprmance of the production environment.
I''ve two db servers. One on my laptop computer (2Ghz, 1GB, WinXP, Cygwin,
Postgres 7.3.4) and one on a production server (2GHz, 1GB, Ultra SCSI,
RH7.1, Postgres 7.3.2).

I run the same dump and the same query on both of the computers. The
difference is substantial.
The query takes 5 times longer on the production server then on the laptop.

What can be the reason? Could anybody suggest me something?
Thakn you in advance.

Best regards,
-- Csaba Együd
Kernel parameters on the linux server:
--------------------------------------
[root@db kernel]# pwd
/proc/sys/kernel
[root@db kernel]# cat shmall shmmax
134217728
134217728
[root@db kernel]#
The query:
----------
explain analyze select
id, artnum, oldartnum, name, munitid, getupid, vtsz, vat, description,
getupquantity, minstock,
(select count(*) from t_prices where t_prices.productid=t_products.id) as
pcount,
round(get_stock(id,1)::numeric,2) as stockm,
round(get_stock_getup(id,1)::numeric,2) as stockg,
(select abbrev from t_munits where id=munitid) as munit,
(select get_order_getup(id)) as deliverygetup,
(select (select deliverydate from t_orders where id=orderid) as
deliverydate
from t_orderdetails
where productid=t_products.id and
not (select delivered from t_orders where id=orderid) limit 1) as
deliverydate,
(select abbrev from t_getups where id=getupid) as getup
from t_products
order by artnum;

QUERY PLAN on my laptop:
------------------------
Sort (cost=70.17..72.38 rows=885 width=184) (actual time=7264.00..7264.00
rows=885 loops=1)
Sort Key: artnum
-> Seq Scan on t_products (cost=0.00..26.85 rows=885 width=184) (actual
time=21.00..7259.00 rows=885 loops=1)
SubPlan
-> Aggregate (cost=28.62..28.62 rows=1 width=0) (actual
time=0.12..0.12 rows=1 loops=885)
-> Index Scan using t_prices_productid on t_prices
(cost=0.00..28.60 rows=8 width=0) (actual time=0.05..0.10 rows=2 loops=885)
Index Cond: (productid = $0)
-> Seq Scan on t_munits (cost=0.00..1.06 rows=1 width=32)
(actual time=0.02..0.02 rows=1 loops=885)
Filter: (id = $1)
-> Result (cost=0.00..0.01 rows=1 width=0) (actual
time=1.13..1.13 rows=1 loops=885)
-> Limit (cost=0.00..149.06 rows=1 width=4) (actual
time=0.09..0.09 rows=0 loops=885)
-> Seq Scan on t_orderdetails (cost=0.00..149.06 rows=1
width=4) (actual time=0.08..0.08 rows=0 loops=885)
Filter: ((productid = $0) AND (NOT (subplan)))
SubPlan
-> Seq Scan on t_orders (cost=0.00..1.27 rows=1
width=14) (actual time=0.00..0.00 rows=1 loops=107)
Filter: (id = $2)
-> Seq Scan on t_orders (cost=0.00..1.27 rows=1
width=1) (actual time=0.02..0.03 rows=1 loops=107)
Filter: (id = $2)
-> Seq Scan on t_getups (cost=0.00..1.16 rows=1 width=32)
(actual time=0.01..0.02 rows=1 loops=885)
Filter: (id = $3)
Total runtime: 7265.00 msec

QUERY PLAN on the production server:
------------------------------------
Sort (cost=70.17..72.38 rows=885 width=121) (actual time=36729.92..36730.18
rows=885 loops=1)
Sort Key: artnum
-> Seq Scan on t_products (cost=0.00..26.85 rows=885 width=121) (actual
time=45.16..36724.73 rows=885 loops=1)
SubPlan
-> Aggregate (cost=9.06..9.06 rows=1 width=0) (actual
time=0.15..0.15 rows=1 loops=885)
-> Index Scan using t_prices_productid on t_prices
(cost=0.00..9.05 rows=2 width=0) (actual time=0.12..0.14 rows=2 loops=885)
Index Cond: (productid = $0)
-> Seq Scan on t_munits (cost=0.00..1.06 rows=1 width=5) (actual
time=0.04..0.04 rows=1 loops=885)
Filter: (id = $1)
-> Result (cost=0.00..0.01 rows=1 width=0) (actual
time=0.80..0.80 rows=1 loops=885)
-> Limit (cost=0.00..149.06 rows=1 width=4) (actual
time=0.08..0.08 rows=0 loops=885)
-> Seq Scan on t_orderdetails (cost=0.00..149.06 rows=1
width=4) (actual time=0.07..0.08 rows=0 loops=885)
Filter: ((productid = $0) AND (NOT (subplan)))
SubPlan
-> Seq Scan on t_orders (cost=0.00..1.27 rows=1
width=14) (actual time=0.01..0.02 rows=1 loops=107)
Filter: (id = $2)
-> Seq Scan on t_orders (cost=0.00..1.27 rows=1
width=1) (actual time=0.01..0.02 rows=1 loops=107)
Filter: (id = $2)
-> Seq Scan on t_getups (cost=0.00..1.16 rows=1 width=11)
(actual time=0.03..0.04 rows=1 loops=885)
Filter: (id = $3)
Total runtime: 36730.67 msec
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.707 / Virus Database: 463 - Release Date: 2004. 06. 15.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

推荐答案

0)

- > seq扫描t_munits(成本= 0.00..1.06行= 1宽度= 32)

(实际时间= 0.02..0.02行= 1循环= 885)

过滤:(id =
0)
-> Seq Scan on t_munits (cost=0.00..1.06 rows=1 width=32)
(actual time=0.02..0.02 rows=1 loops=885)
Filter: (id =


1)

- >结果(成本= 0.00..0.01行= 1宽度= 0)(实际

时间= 1.13..1.13行= 1个循环= 885)

- >限制(成本= 0.00..149.06行= 1宽度= 4)(实际

时间= 0.09..0.09行= 0循环= 885)

- > seq扫描t_orderdetails(成本= 0.00..149.06行= 1

宽度= 4)(实际时间= 0.08..0.08行= 0循环= 885)

过滤:((productid =
1)
-> Result (cost=0.00..0.01 rows=1 width=0) (actual
time=1.13..1.13 rows=1 loops=885)
-> Limit (cost=0.00..149.06 rows=1 width=4) (actual
time=0.09..0.09 rows=0 loops=885)
-> Seq Scan on t_orderdetails (cost=0.00..149.06 rows=1
width=4) (actual time=0.08..0.08 rows=0 loops=885)
Filter: ((productid =


0)AND(NOT(subplan)))

SubPlan

- > seq扫描t_orders(成本= 0.00..1.27行= 1

宽度= 14)(实际时间= 0.00..0.00行= 1个循环= 107)

过滤:(id =
0) AND (NOT (subplan)))
SubPlan
-> Seq Scan on t_orders (cost=0.00..1.27 rows=1
width=14) (actual time=0.00..0.00 rows=1 loops=107)
Filter: (id =


这篇关于RH7.1的性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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