# Querying and Extracting Timeline Information from Road Traffic Sensor Data
## 5 Timeline Query Index and Analytical Query Processing
### TQ-index Construction
#### Congestion Event Detection
The costs for \(TM\) extraction and insertion into \(TI\) become dominant as the dataset size increases, while the cost for \(LI\) remains the same and the cost for insertion to \(TiL\) also increases. Note that the cost for insertion into \(TI\) for the \"Busan\" dataset increased dramatically, while the insertion cost for the \"Seattle\" dataset slightly increased. The types of roads included in the datasets could be one reason. The \"Busan\" dataset consists of primary roads and highways. In some cases, several roads can be connected by one node, which results in many neighboring road links. However, the \"Seattle\" dataset contains only freeways. It is sufficient to check the next and the previous road links of a particular road link. The other reason is the amount of traffic congestion. Typically, substantial traffic congestion occurs in primary roads compared to freeways. Thus, the cost of the \"Busan\" dataset is dramatically increased with the dataset size. Because we used the same road network, the construction time for \(LI\) does not change significantly and remains almost the same. The cost for insertion to \(Til\) is slightly increased, because we insert a set of events into the list after checking the \(START\) status of each traffic event. In this case, the number of events is slightly increased with the size of the dataset. As we explained in Section 5.2.2, extracting the timeline model from raw traffic data is more expensive because of the disk I/O operations. Figure 16a,b show the detailed cost breakdown of \(TM\) extraction. The cost for calculating the congestion dependency becomes the dominant cost for both the \"Busan\" and \"Seattle\" datasets as we increase the data size, whereas the cost of reading raw traffic data is always the dominant cost. Detecting a congestion event occurs within a short time. As we expected, \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Month** & \(LI\) **Construction** & \(TM\) **Extraction** & **Insertion to \(TiL\)** & **Insertion to \(TI\)** & **Total Time** \\ \hline
8 & 0.17 & 95.23 & 0.09 & 37.47 & 132.97 \\
12 & 0.19 & 138.64 & 0.13 & 89.88 & 228.84 \\
16 & 0.19 & 211.20 & 0.16 & 154.85 & 366.40 \\
20 & 0.21 & 262.49 & 0.33 & 232.20 & 495.23 \\
24 & 0.25 & 304.77 & 0.24 & 327.70 & 632.96 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Building time for a TQ-index using Busan ITS data (s). \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Month** & \(LI\) **Construction** & \(TM\) **Extraction** & **Insertion to \(TiL\)** & **Insertion to \(TI\)** & **Total Time** \\ \hline
2 & 0.01 & 77.16 & 0.03 & 4.70 & 81.90 \\
3 & 0.01 & 116.78 & 0.04 & 9.15 & 125.98 \\
4 & 0.01 & 155.23 & 0.05 & 15.86 & 171.15 \\
5 & 0.01 & 197.28 & 0.06 & 26.27 & 223.62 \\
6 & 0.01 & 245.55 & 0.07 & 39.72 & 285.35 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Building time for a TQ-index using Seattle freeway data (s). it takes a significant amount of time to read raw traffic data because this process requires disk I/O operations while the other steps are run in the main memory. Calculating the congestion dependency status checking of all neighboring congestion to decide whether congestion is dependent. The cost for the \"Busan\" dataset increased dramatically, and the cost for the \"Seattle\" dataset slightly increased. The costs for this step could also be explained by the characteristics of the two datasets. Figure 17a,b show the effective reduction of memory consumption by comparing the size of the TQ-index with that of the raw traffic sensor data. The gaps in size widen as we increase the date range from 8 months to 24 months. We observe that the size of the TQ-index is much smaller than that of the raw traffic files in both datasets. This is because the QET system can effectively convert historical raw traffic sensor data into a smaller size TQ-index based on the timeline modeling. Another observation is that the TQ-index in Figure 17b reduces the raw traffic sensor data more effectively.