Wednesday, May 7, 2008

[BUGS] ORDER BY...LIMIT optimization does not work with inherited tables

PostgreSQL 8.3 added a new optimization to avoid sorting in queries that
use ORDER BY ... LIMIT. This optimization does not work when the query
is issued to a parent table with several children, such as a partitioned
table.

PostgreSQL version: 8.3.1
Operating System: RedHat Enterprise Linux 4

The attached example shows a query to a single table that uses the ORDER
BY ... LIMIT optimization. Then it shows that the query does not
optimize (uses sort) when executed to the parent of that table. Execute
as a user that can create databases as "psql -f
order_by_limit_partition_test.sql postgres". It creates a database
called test_order_by_limit_db.

No comments: