Re: Set explain utility
Posted in 1997
In article <33A6397D.3519@west.co.za>, "Mark D. Stock"
<marks@west.co.za> writes
>MarkDenham@aol.com wrote:
>>
>
>If you do not use PREPARE, your statement is parsed and optimised by
>the OPEN.
>
>If you use PREPARE, your statement is parsed by the PREPARE, and
>optimised by the OPEN.
>
>Hope that helps,
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.
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
OPEN c1
END MAIN
Bingo! set sqexplain.out produced.
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