Friday, June 13, 2008

procedure analyse has its limits

Today whilst attempting to use procedure analyse against a customers tables I discovered that it doesn't work whilst using LIMIT in the SELECT query.
SELECT * FROM tablename LIMIT 10000 PROCEDURE ANALYSE()\G

The work around is to create a temporary table.

CREATE TEMPORART TABLE tmp_tablename from SELECT * FROM tablename LIMIT 10000;
SELECT * FROM tmp_tablename PROCEDURE ANALYSE()\G
DROP TABLE tmp_tablename;

No comments: