Re: SET EXPLAIN / SQL
Posted in 1998
David I assume that the user enters the query using a Query Wizard type of tool, in which case he does not have a provision for runtime variable assignment in the SQL (eg, SELECT * FROM sometable WHERE somecolumn = ?). If that is the case then once your query runner recieves the SQL, it would PREPARE it to check for syntax errors. Just before the PREPARE add a SET EXPLAIN ON. The query plan would be generated in a file called sqexplain.out in the current directory at the time of PREPARE. The runner can then parse the sqexplain.out file to determine the cost and decide whether to run the SQL. HTH Sujit ______________________________ Reply Separator _________________________________ Subject: SET EXPLAIN / SQL Author: "David K. Killough" <killougd@ix.netcom.com> at internet Date: 9/4/98 9:22 AM Using 4GL/SQL, is there a way to 1) obtain SET EXPLAIN output without executing the query and 2) accessing that output in order to conditionally run the query We have a very flexible way for users to create queries (sort of like construct, but more powerful.) The price, of course, is that they could create a resource intensive query that may not be desired (we have 400 users.) If we could parse the cost or indexing strategy we could determine when a heavy query has been requested, and protect our system from running too many of these at a time. We have Dynamic Server 7.3 (UC3-1) and 4GL 6.05 (we just got 4GL 7.2 but have not installed it) Thanks in advance for any response..... Dave Killough