How to get query execution time without query result


#1

for example, I want to know the query execution time ,but I donot want to show the result. I look the same topic in the web, but the consume function does not show how to use.
Just as the scan function ,the real result is as following
AFL% scan(A);
{i} val
{0} 1
{1} 2
{2} 3
{3} 4
{4} 5
{5} 6
{6} 7
{7} 8
{8} 9
{9} 10
Query execution time: 4ms

But the wanted result is as following

AFL% scan(A);
Query execution time: 4ms

Thank you for your advice!


#2

To use the consume operator, just wrap it around your query:

AFL% consume(scan(A));
Query was executed successfully

However, this hides the iquery execution timer for some unknown, un-good reason, so it is best to use an external timer on the command line:

~$ /usr/bin/time -f %E iquery -aq "consume(list())"
Query was executed successfully
0:00.08

#3

Thanks for your reply
The time is different using different method, as following:

AFL% list();
Query execution time: 5ms

~$ time iquery -aq “consume(list())”;
Query was executed successfully
real 0m0.036s
user 0m0.012s
sys 0m0.000s

the time that list command costs in scidb terminal is much faster than ubuntu terminal


#4

Yes, the console version also includes starting/stopping the iquery executable itself, which looks to be about 0.031s in your case. Most of the queries I care about timing run from minutes to hours to days, so this additional time is miniscule. If you are comparing query A vs. query B, then this overhead occurs for both, and may be ignored as a common factor.


#5

I made a “scidbtime” script to measure the execution time of my query:

port=1239
/usr/bin/time -f “%e seconds” iquery -anp $port -q “$1”