0

我维护的系统似乎每隔几天就会变慢一点,我认为它来自某个地方的错误查询。

据我所知,我已将问题缩小到一两页。这是我认为导致问题的页面上的查询。

select a.s_purchase_order as order_id, a.order_type, a.nobackorder, a.order_note, a.note, a.rqst_dlvry_date, b.customer_name ,c.store_name,(c.store_name + ',' + isnull(c.address1 + ',', ' ') +  isnull(c.city + ',', ' ') +  isnull(c.state_cd+ ',', ' ')  + isnull( c.zipcode, ' ')) as store_info, d.supplier_account
from VW_CustomerOrder a, Customer b, Store c, eligible_supplier d
where a.customer = c.customer
and a.store = c.store
and a.customer = b.customer
and c.customer *= d.customer
and c.store *= d.store
and a.supplier *= d.supplier
and a.purchase_order = @order_id
and a.customer = @customer_id
and a.store=@store_id
and a.supplier = @supplier_id

是否有明显的东西会非常慢或导致系统随着时间的推移而变慢?

4

1 回答 1

1

怎么样做一些内部连接来解决这个问题,检查你的基础并查看这些表的索引和外键,这对查询和性能总是有帮助的

选择
  a.columun_a,b.column_a 来自 table_a
a.id = b.id 上的内部连接 ​​table_b b
在哪里
  b.column_b = "某个值"
于 2012-08-02T17:17:10.137 回答