請教oracle db問題

來源: 2014-06-23 09:17:36 [博客] [舊帖] [給我悄悄話] 本文已被閱讀:

我有個特別complex的SQL query cursor, takes a long time (a few hours)to complete. And very often it failed with oracle error "snapshot too old rollback segment too small". 原因是我用的table data 都是changing frequently的。我就決定把裏麵的每個subquery 都分別寫到temp table裏,然後在main cursor 裏在join these temp tables. 我覺得這樣應該能work的。可是reviewer讓我證明這樣能解決問題。煩死了,query那麽大又不是我的錯。db 高手們有什麽好主意? 除了加 table index外,query還能怎麽optimize?