cancel
Showing results for 
Search instead for 
Did you mean: 

No output from EXPLAIN

Former Member
0 Kudos

Hi,

I want to use EXPLAIN for performance analysis of my SQL statements. But EXPLAIN does not print out anything, here's some sample output:

sqlcli MAXDB1=> explain select 1 from dual
2 rows affected (3992 usec)

That's all. Somewhere I read about a table named 'EXPLAIN' which EXPLAIN writes its results into, but also that table does not exist:

sqlcli MAXDB1=> select * from explain
* -4004: POS(15) Unknown table name:EXPLAIN SQLSTATE: 42000

I don't get it, what's wrong here? Do I have to install that EXPLAIN table manually (like in Oracle)? I did't find anything about that...

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Hello Martin,

why not use one of the more userfriendly SQL GUIs, like SQL Studio or DB Studio?

Ok, for sqcli it's a bit counter intuitive, but it still works.

However, for any 'serious' work with SQL I'd always go for the GUI tools.

sqlcli -d db77 -u lars,lars

Welcome to the MaxDB interactive terminal.

Type:  \h for help with commands
       \q to quit

sqlcli db77=> explain select * from t1
2 rows affected (2590 usec)

I guess that is what you see --- not much at all.

The reason is the default setting for the usage of prepared statements.

Turning them off lets sqlcli run the query against the SHOW table (check the documentation for that one yourself ) and displays the result:

sqlcli db77=> \ps
Usage of prepared statement switched OFF
sqlcli db77=> explain select * from t1
| SCHEMANAME    | TABLENAME    | COLUMN_OR_INDEX  | STRATEGY                                 | PAGECOUNT  |
| ------------- | ------------ | ---------------- | ---------------------------------------- | ---------- |
| LARS          | T1           |                  | TABLE SCAN                               |          1 |
|               | SQLCURS_2    |                  |    RESULT IS NOT COPIED , COSTVALUE IS   |          1 |
2 rows selected (1168 usec)

sqlcli db77=>

I guess that's what you wanted, is it?

regards,

Lars

Former Member
0 Kudos

Yes, exactly, thanks!

Answers (0)