Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to get the last query path and plan?
PRODUCT: 4D Developer | VERSION: 11.1 | PLATFORM: Mac & Win
Published On: April 9, 2008

Sometimes it is a good idea, when you are querying some fields in table/tables, to be able to check what exactly the optimizer is doing behind the scenes in order to handle the query. This can help you improve your code and speed up you queries.

In 4D v11 SQL Release 1 (11.1) there are two functions which can do this for you;

` also, in brackets, can be description in xml format.
Get last query plan (“description in text format”)
Get last query path (“description in text format”) ` the same as above.

These two functions return a detailed internal description of the query plan and the actual path performed from the optimizer.

You can get quick report if you assign the return values to variables and display these variables, but also you can get more detailed information if you send the contents of these variables to a file. In this case you make sure that “Describe Query Execution” command has been executed before the two functions