September 30, 2016
Question
Counting results from a SQL Query is very slow
- September 30, 2016
- 5 replies
- 1921 views
Hi all,
i work on a big repository (AEM6.1) and some queries works on a lot of nodes. for example this query
select * from cq:PageContent where sling:resourceType='quattroruote/components/page/newspage' AND publishDate > TIMESTAMP '2013-01-01T00:00:00.000Z' AND publishDate < TIMESTAMP '2013-12-31T00:00:00.000Z' AND external IS NULL ORDER BY publishDate DESC
tooks about 1115ms the first time is run.
but if i have to count how many results the query return, time spent rise to severals seconds. in this case to 49.153 ms. (4457 nodes)
I attached the json results from Explain Query Tool.
Is there any way to get the counter using less time?
Thanks