See the attached test case.  With that setup, this uses MergeAppend:

explain select * from ma_parent order by id limit 10;

But this one does not:

explain select * from ma_parent order by name limit 10;

...which seems odd, because the index on ma_child1 and sorting the
other two ought to still be better than appending all three and
sorting the whole thing.  If you drop ma_child2, you get MergeAppend
again:

begin;
drop table ma_child2;
explain select * from ma_parent order by name limit 10;
rollback;

...which makes me wonder if our costing model is off?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment: inh.sql
Description: Binary data

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to