Tech Tip: Accessing query information using queryPlan and queryPath
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: May 7, 2020
When performing a query using dataClass.query(), you may pass a querySettings parameter as an object containing additional options. Two of these options are to include the queryPlan and queryPath in the resulting entity selection. Example code below:
$q:=ds.EMPLOYEES.query("department.Name = :1";"Art";New object("queryPlan";True;"queryPath";True)) |
In the returned entity selection, there will be two additional properties called "queryPlan" and "queryPath".
![](https://kb.4d.com:443/kbase/assets/images/78454-1.jpg)
These properties have information on the query type (indexed or sequential) as well as each necessary subquery along with conjunction operators. Also, queryPath contains the number of entities found and the time (in milliseconds) required to execute each query step. This information is especially useful for analysis during application development, for instance if you wanted to compare the speed of the search queries in your application.
For more information, read the "About queryPlan and queryPath" section in the documentation here: https://doc.4d.com/4Dv18/4D/18/dataClassquery.305-4505887.en.html