I'm quite new to understanding persistent data structures, so bear with me.
Consider some database with data of the form $(\text{id}, d_1, d_2)$. The last two could e.g. mean production data and sales date, respectively. The database is constant, i.e. we will not be adding or removing data points.
Let $n$ be the number of items in the database. I want to be able to do the following query:
Query$(a,b,s)$: Return the number of objects that have $a\leq d_1 \leq b$ and $d_2 \leq s$.
I want to be able to perform the query in $\mathcal O(\log n)$ time, with the best possible space and preprocessing time complexities. My question is how could one construct a persistent data structure that solves this problem?
I think that I need to use timestamps that relate to the $d_1$ and/or $d_2$ in some way. However, I'm not quite sure how.