如何优化Sybase Sql查询?

时间:2015-10-07 10:01:10

标签: sql query-optimization sybase

我有一个从Sybase数据库中获取数据的SQL查询。在where子句中,我们根据需求(BU IN ('CMBS','MBS') AND RU='GBR')使用文本列。这些条款正在扼杀性能。使用的表具有大量行。

有任何提高绩效的建议吗?

下面是SQL -

SELECT [COLUMN LIST]
from dealer_Key dk, 
INNER JOIN d_posting dp ON dk.deal_key_id = dp.deal_key_id, 
INNER JOIN d_p_v dpv ON dp.posting_id = dpv.posting_id,
INNER JOIN snapInfo s ON dpv.snapshot_start_id = s.snapshot_id, 
INNER JOIN psgl_ratemeter r ON (dp.gl_currency = r.from_currency),
INNER JOIN psgl_ratemeter_value rv (ON r.psgl_rate_id = rv.psgl_rate_id AND rv.refdate = dpv.gl_transaction_effective_date)
where 
r.snapshot_end_id is null
and r.to_currency = 'AUD'
and (dp.snapshot_end_id is null or dp.snapshot_end_id > dpv.snapshot_start_id)
and dpv.gl_transaction_effective_date > '20140930'
and dpv.gl_transaction_effective_date < '20150901'
and gl_business_unit IN ('CTCMB')
and gl_currency='CAD'
and gl_counterparty='IMCLIMTR'
and gl_location='SYD'
and gl_department='LTFSY'
and gl_product='FEES'

0 个答案:

没有答案