oracle分區表查詢

來源:互聯網
上載者:User

標籤:

ORACLE分區表的查詢 假如 [分區表] 在欄位 [createdate] 上進行分區,每個月為一個分區:2009年6月為分區P2009062009年7月為分區P2009072009年8月為分區P200908   執行SQL 使用分區鍵檢索:select*from 分區表 t where createdate > to_date(‘2009-07-12‘,‘yyyy-mm-dd‘) and createdate < to_date(‘2009-08-12‘,‘yyyy-mm-dd‘) 執行計畫如下,使用分區鍵進行索引,會自動在資料存在的區進行檢索。因為開始區為2,結束區為3,一目瞭然。SELECT STATEMENT, GOAL = ALL_ROWSPARTITION RANGE ITERATOR    Partition start=2    Partition stop=3  TABLE ACCESS FULL            Partition start=2    Partition stop=3  執行SQL 不使用分區鍵檢索:select*from 分區表 t where sms_report_date > to_date(‘2009-07-12‘,‘yyyy-mm-dd‘) and sms_report_date < to_date(‘2009-08-12‘,‘yyyy-mm-dd‘) 執行計畫如下:沒有使用分區鍵進行檢索,那麼則會查詢全部的表分區。因為要查詢的資料就在2和3分區上,其它的分區資料也被讀取了,增大了資料庫壓力,效率低下。SELECT STATEMENT, GOAL = ALL_ROWS  www.2cto.com  PARTITION RANGE ALL        Partition start=1    Partition stop=31  TABLE ACCESS FULL            Partition start=1    Partition stop=31  執行SQL 指定使用分區:select*from 分區表 partition(P200907) t where sms_report_date > to_date(‘2009-07-12‘,‘yyyy-mm-dd‘) and sms_report_date < to_date(‘2009-08-12‘,‘yyyy-mm-dd‘) 執行計畫如下:SELECT STATEMENT, GOAL = ALL_ROWSPARTITION RANGE SINGLE        Partition start=2    Partition stop=2  TABLE ACCESS FULL            Partition start=2    Partition stop=2

oracle分區表查詢

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.