3
這些表在一個PostgreSQL 9數據庫分配。當我運行以下腳本時:上的PostgreSQL使用時功能partitoned表確實全表掃描
select * from node_channel_summary
where report_date between '2012-11-01' AND '2012-11-02';
它從適當的表發送數據而不進行全表掃描。然而,如果我運行這個腳本:
select * from node_channel_summary
where report_date between trunc(sysdate)-30 AND trunc(sysdate)-29;
在這種情況下,它執行全表掃描,性能是不可接受的。 -30和-29將被參數替換。
做一些研究之後,Postgres的不正確使用函數和分區表工作。
是否有人知道作爲一個變通來解決這個問題?
您使用的表繼承來實現分區? – 2012-12-04 14:59:58
什麼是'trunc()'和'sysdate'?他們當然不是PostgreSQL的東西... – dezso
我認爲我們實際上是在談論[EnterpriseDB公司(http://enterprisedb.com/solutions/oracle-compatibility-technology):從根本上PostgreSQL的,但無數支持Oracle特性,包括[ 'TRUNC()'和'sysdate'](http://www.enterprisedb.com/docs/en/9.1/oracompat/Postgres_Plus_Advanced_Server_Oracle_Compatibility_Guide-72.htm#P5531_309120)。 – willglynn