Re: Access to Optimizer results
Posted in 1997
Laurence M. Cerier wrote: > > We are using version 7.2 on HP-UX 10.10, and would like to know if there is > any way to access to "cost" (from the optimizer) of a query while the query > is executing without having the explain plan written out to a dataset. > > We are trying to develop a quey govenor that can be used to detect > potentially long running queries and cancel them (so they can be run at a > better time) before flooding the system. Hi, I didn't check whether you can retrieve the information from the sysmaster:sqexplain.sqx_estcost column. Possibly this information can be only retrieved, when you SET EXPLAIN ON. But each programmer can give you the information. The information will be stored in the SQLCA.SQLERRD[4] record, or sqlca.sqlerrd[3] element. ( 4GL / ESQL-C ). This information can be picked up immediately after a PREPARE ( without any questionmark ) or after your OPEN cursor statement. ( See also: OPEN ... WITH REOPTIMIZATION ). Bye Stefan