Re: Set Explain On in SP with Cursor
Posted in 1999
Hi, you have to put 'set explain on' in front of the 'create procedure' statement, as the optimizer-plans are evaluated at "compile"-Time. As the underlying tables may change over time, you should run a 'update statistics for procedure ...' statement to get appropriate query-plans. hth martin "Marichamy, Udaykumar" schrieb: > > Hello all Informix lovers, > > Can anybody help me with this 'set explain' question? > > I have a cursor SELECT in an Informix stored procedure, and also an UPDATE > inside the foreach loop. I would like to execute 'set explain on' so that it > outputs the query plan for both the SELECT and UPDATE. I am trying to see if > the queries are using the indexes. I have tried including 'set explain on' > just before the cursor declaration (foreach <cursorname> for). It does not > work. > > Anybody? Thanks in advance. > > Uday