Re: SET EXPLAIN / SQL
Posted in 1998
Stefan Weideneder wrote: > > Hi David, > > as Sujit mentioned already, the results of SET EXPLAIN are > available as soon as you prepared your query. > This is not always true, but in most cases. > > If the query contains no question-mark "?", your query will > be optimized at the time of the prepare. Otherwise it will > be optimized at the EXECUTE or OPEN/FOREACH statement. Actually, all SQL is optimized at the time it is prepared EVEN if it has replacable parameters ("?"). This is why the SET EXPLAIN output for a query with a replacable parameter on a column that is part of the fragmentation expression of a table will always scan all fragments unless a non-fragmented (or fragmented on another column), detached, index is selected by the optimizer. Art S. Kagel