next up previous contents
Next: Calibration that do change Up: BRAHMS Database Time Validity Previous: Reduction of the `online'

Solution to the bad query problem

Let's try to solve the bad query problem.

Obviously if we allow the application to call getData() with arbitrary $[t_{start}\ldots t_{end}]$ time intervals, we have a problem because they can easily overlap the validity intervals stored into the database.

We have to restrict what tstart and tend the application can use.

What restrictions make sense? We have already decided that getData() is called once for each parameter at the beginning of the run to get the values to be used in the analysis of that run.

Let us demand that tstart and tend of any query be the run start and end times. Or at least that

\begin{displaymath}start_{run} \leq start_{query} < end_{query} \leq end_{run}
\end{displaymath}

Does it help? Yes, but not quite. We still get into trouble if data in the database changes in the middle of a run, as in Figure 8.


  
Figure 9:
\begin{figure}
\epsfig{file=KObratdb7.eps,width=\textwidth}\iffalse
\begin{tex2h...
...y3-------\vert <-- bad query\end{verbatim}\end{tex2html_preform}\fi
\end{figure}

Here we have eliminated the bad queries similar to query2and were doing fine until we hit query3, which is bad because cal4 ends in the middle of run4.

Bad query3 cannot be fixed by putting restrictions on the type of queries that aplications are allowed to make. We need to apply restrictions on the data in the database.

Let's demand that validity intervals also always match run start and end times, as in Figure 9


  
Figure 10:
\begin{figure}
\epsfig{file=KObratdb8.eps,width=\textwidth}\iffalse
\begin{tex2h...
...---> time
t1 t2 t3 t4 t5 t6\end{verbatim}\end{tex2html_preform}\fi
\end{figure}

In this example I added a quirk -- the `special Ian's' calibration cal5 which spans multiple runs and overlaps with cal3.

But even with this quirk, the restriction that queries are always done on run boundaries (or inside), makes it impossible to do bad queries. Any possible query is well behaved.

Conclusion: the bad query problem is solved by requiring that validity intervals stored in the database correspond to the run start and end times; and that queries are always done on one run at a time, so that $start_{run} \leq start_{query} < end_{query} \leq end_{run}$.


next up previous contents
Next: Calibration that do change Up: BRAHMS Database Time Validity Previous: Reduction of the `online'
Christian Holm Christensen
2000-05-15