2
mysql> EXPLAIN EXTENDED
    create algorithm =temptable view fisgen_temptable(inter,phone)
    as select intercom1,phone from fisgen where fid='f105';

I am getting an error like this:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'create algorithm =temptable view fisgen_temptable(inter,phone) as select interc' at line 2

2

EXPLAIN shows an execution plan for SELECT queries. In version 5.6, it was extended to include plans for INSERT, UPDATE, DELETE and REPLACE statements.

No version of MySQL (not even the still in development, 5.7) has EXPLAIN for CREATE TABLE or CREATE VIEW.

You can of course run the explain for the select (that defines the view):

EXPLAIN EXTENDED
    select intercom1,phone from fisgen where fid='f105';

or as @jynus suggested (thank you), the more useful:

EXPLAIN EXTENDED
    select * from fisgen_temptable;
  • For @Lakshmi Also, EXPLAIN CREATE VIEW in current versions of MySQL would make no sense, as there are no materialized tables- query is not executed at creation time. You can, however, EXPLAIN SELECT * FROM fisgen_temptable. – jynus Mar 9 '15 at 11:22
  • 1
    @jynus, thnx, I've added you suggestion in the answer. I think it's more useful. – ypercubeᵀᴹ Mar 9 '15 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.