The HEAP engine uses fixed length rows. For variable length columns each row allocates the max size per column so a lot of memory can be wasted. When the temp table gets too big, it is converted to a MyISAM table. The switch is done when the size of the table is min(max_heap_table_size, tmp_table_size) (I think that equation is right, wouldn't it be nice if it were simpler?).
In some cases UNION ALL can be used to reduce network round trips when there are multiple SELECT statements that return similar columns: select * from foo UNION ALL select * from bar. While this reduces network latency, it can increase the load on the server from writing the temporary table.
A feature request might be open to not use a temporary table for UNION ALL. Search for more details on this topic.
What happened to the change to not allocate the max length for variable length columns in the HEAP engine? When will it appear in an official release? There is a feature request for it.
And now, a quiz from Domas. What is done for the following?
(select * from foo UNION ALL select * from bar) limit 10
PlanetMySQL Voting:
Vote UP /
Vote DOWN"
No comments:
Post a Comment