Question about iquery client of version 12.3


#1

Hello!
I have a question about iquery client.
The thing is I try to report query run-time without retrieving query results. However, when I type both of the “set no fetch” and “set timer” commands only “set no fetch” command works. Does it means that only if I retrieve the query results then can I get the query run-time?
The detail things are like this:

AFL% set no fetch;
AFL% set timer;
AFL% load(nameOfArray, 'PATH/fileName');

The result is always

not something like

I also tried the method which is creating the iquery.conf file and set the timer option to true. But it doesn’t work either. And also I tried the method to pass the AFL query directly such as

iquery -ntaq "load(nameOfArray,  'PATH/fileName')"

The result is always

Is there any method that gets the query run-time without fetching query results?


#2

Hello,

There are some fundamental “philosophical” questions about what “query run-time” actually means.

One thing you could say is:

$ time iquery -anq "QUERY"

This will give you a runtime (as per the unix time utility) without retrieving results. But unfortunately some scidb queries are computed lazily; the system will not do any work if you don’t ask for the results. So this won’t work.

So…

Method 1

$ time iquery -aq "QUERY"
$ time iquery -aq "QUERY" > file.out

Now you are measuring multiple things:

  1. time to run the query
  2. time to return the result to the coordinator
  3. time to convert the result to text form and dump it to file / stdout

Unfortunately if your result set is large, step 3 will take up most of the time - and you will not be measuring the right thing. However, if the result set is small, then this method works reasonably well. Note that you can have large complex queries that return one or ten values.

Method 2

$ iquery -r /dev/null -avq "QUERY"

This way will ship all the data to the coordinator and iterate over the entire result. But it will not convert the result to text form. It will also make iquery output some cute timings and stats.

One other thing you can try is:
Method 3

$ time iquery -anq "store(QUERY, TEMP)"

This measures the amount of time to run the query and store it as a temporary array. Of course, storing the data can be expensive, so you can only use this method relative to other store() queries. I like this method because it works for all result set sizes and has a nice property of data never leaving the system.

So if your result set size is small, I recommend Method 1. If your result set is large, I recommend either Method 2 or Method 3.

Hope it helps.

  • Alex Poliakov

#3

Hello!

I had tried all of the methods and they all worked well. It seems like the queries I have written are not the ones which computed lazily.
Anyway,they really helped me. Thank you very much!!! :mrgreen: