next up previous contents
Next: Code examples Up: Advanced topics Previous: Helpers for pretty printing   Contents

Query modifiers

DB-ALLe allows to set special query behaviours using the "query" parameter. The available options are:

best
When measures from different kinds of reports exist in the same physical space, do not return them all, but only return the one of the record type with the highest priority.
bigana
Use special query optimizations that make things faster when there are a lot of stations in the database, and slower otherwise. If you are having slow queries, try setting this option and see if it helps.
nosort
Return the results in a nondefined order. It can make things faster when writing algorithms that do not depend on the ordering of data from DB-ALLe.
stream
Normally the functions idba_quantesono or idba_voglioquesto will read all the results from the server, count them and save them locally.

When using this option, those functions will return right after performing the query, and the results will be read later using idba_elencamele or idba_dammelo. As a side effect, idba_quantesono and idba_voglioquesto cannot know in advance the result count, and will return some undefined value in it.

When using this option, the only way to find out when to stop reading is to know that idba_elencamele and idba_dammelo will set all the output parameters to undefined when there is no more data to read. One could thus use a loop like this:

      call idba_setc (handle, "query", "stream")
c     Make the query
      call idba_voglioquesto (handle, N)
c     Iterate the results.  Ignore N because it is
c     meaningless when using query=stream
      do
        call idba_dammelo (handle, varname)
c       If ana_id is missing value, then we are done
        idba_enqi(handle, "ana_id", value)
        if (value .eq. 2147483647) exit

c       ...process the data...
      enddo

This option can be a significant improvement in speed and memory when the result count is not needed in advance. The speed improvement comes because the client can start doing computations on the results while the server is still generating the results, taking advantage of parallelism, especially if the server and the application are on two different computers.

Without using this option, the client cannot start to use the results until the server has finished computing and trasmitting them.


next up previous contents
Next: Code examples Up: Advanced topics Previous: Helpers for pretty printing   Contents
root 2007-06-20