Need help to get execute plan
Posted in 1999
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL
I make deamon program with informx ESQL/C I'm trying to get execute plan, I use SET EXPLAIN command, but this command's output file sqexplain.out. I want to set output file name "sqexplain.out" every executing SQL statement. How to set output file name? Where are sample programs..? thank you for your kinds. -- SIFT Information & Communication Co. E-mail : jopark@sift.co.kr Seoul, Korea ----------------------------------------------
> I make deamon program with informx ESQL/C > I'm trying to get execute plan, > I use SET EXPLAIN command, but this command's output file sqexplain.out. > So, in the code you used "EXEC SQL set explain on" ? > I want to set output file name "sqexplain.out" every executing SQL > statement. > How to set output file name? > Where are sample programs..? I have never seen any reference to the ability of setting the output file name for 'set explain'. If you have multiple SQL calls after one set explain on, Informix will just simply append to the sqexplain.out file. This would be expensive, but you could do the following: EXEC SQL set explain on; EXEC SQL execute mysqlstmt1 using :myvar; EXEC SQL set explain off; system("cp sqexplain.out mysqlstmt1.out"); EXEC SQL set explain on; EXEC SQL execute mysqlstmt2 using :myvar2; EXEC SQL set explain off; system("cp sqexplain.out mysqlstmt2.out"); And so on. I would not suggest this for production, and this is probably only useful if you actually #DEFINE the statements so you can turn on and off this functionality in the code without having to go back and uncomment/comment out each one. Does anyone have a better idea? This might prove to be useful, so if someone knows of some undocumented environment variable or such that can be set to do this, please share.