Posted on 2009-01-12 21:55
Robert Su 閱讀(262)
評論(0) 編輯 收藏 所屬分類:
數(shù)據(jù)庫
之前做聯(lián)合查詢很慢也很麻煩;需要對web_video表跟webvideo _day視圖做聯(lián)合查詢,但是速度奇慢
select a.* from web_video a webvideo b where a.id=b.id and a.site_id=?
換成這種方式之后就快多了
select a.* from web_video a where a.site_id=? and a.video_day=to_number(to_char(sysdate, 'yyyymmdd'));
video_day是一個物化視圖 MATERIALIZED VIEW——可以大大提高數(shù)據(jù)庫查詢的速度。