Re: Set explain utility
Posted in 1997
David Williams wrote:
SNIP
> Set explain output is ONLY created when you actually open the cursor,
> I tested this on my machine at work today (4GL 6.0x / SE 7.1x).>
> You get syntax errors if you try to prepare something which is
> not valid syntax (I've had these yesterday!).
>
> Doing
>
> DATABASE djw
>
> MAIN
> DEFINE x CHAR(200)
> SET EXPLAIN ON
> LET x = "select * from site"
> PREPARE p1 FROM x
> DECLARE c1 CURSOR FOR p1
> END MAIN>
> no sqexplain.out produced.
>
I did exactly the same, on Version 4.1, 5.00, 6.0 and 7.22UC1 (OnLine)
on different platforms like
SCO
Solaris
HP-UX
SINIX
The sqexplain.out file exists immediately after the prepare.
Please, try it again.
> The optimizer DEFINATELY parses statements when they are prepared.
>
> The optimizer ONLY produces sqexplain.out files when the cursor if
> opened.
>
> My next question is when is it optimizer, I assume when the cursor is
> opened since otherwise a needed index could be dropped between when
> the prepare is done and when the open is done...
>
> Anyone able to give a definate statement about when optimization is
> done?
>
>
>
> --
> David Williams
Bye
Stefan