diff --git a/appendix.tex b/appendix.tex index fd2a3c4..8f5d3ab 100644 --- a/appendix.tex +++ b/appendix.tex @@ -37,8 +37,8 @@ We require that vertices have an in-degree of at most two. Note that we can construct circuits for \bis in time linear in the time required for deterministic query processing over a possible world of the \bi under the aforementioned assumption that $\abs{\pxdb} \leq c \cdot \abs{\db}$. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\subsubsection{Circuit size vs. runtime} -\label{sec:circuit-runtime} + +\subsection{Modeling Circuit Construction} \newcommand{\bagdbof}{\textsc{bag}(\pxdb)} @@ -184,6 +184,32 @@ As in projection, newly created vertices will have an in-degree of $k$, and a fa There are $|{Q_1} \bowtie \ldots \bowtie {Q_k}|$ such vertices, so the corrected circuit has $|V_{Q_1,\pxdb}|+\ldots+|V_{Q_k,\pxdb}|+(k-1)|{Q_1} \bowtie \ldots \bowtie {Q_k}|$ vertices. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsubsection{Bounding circuit depth} +\label{sec:circuit-depth} + +We first show that the depth of the circuit (\depth; \Cref{def:size-depth}) is bounded by the size of the query. Denote by $|\query|$ the number of relational operators in query $\query$. + +\begin{Proposition}[Circuit depth is bounded] +\label{prop:circuit-depth} +Let $\query$ be a relational query and $\dbbase$ be a \dbbaseName. There exists a (lineage) circuit $\circuit$ encoding the lineage of all tuples $\tup \in \query(\dbbase)$ for which +$\depth(\circuit) \leq O_k(|\query|\log(n))$ +\end{Proposition} + +\begin{proof} +We show that the bound of \Cref{prop:circuit-depth} holds for the circuit constructed by \Cref{alg:lc}. +First, observe that \Cref{alg:lc} is invoked exactly once for every relational operator or base relation in $\query$; It thus suffices to show that an invocation \Cref{alg:lc} adds at most $O_k(\log(n))$ to the depth of any circuit produced by a recursive invocation. +Second, observe that modulo the logarithmic fan-in of the projection and join cases, the depth of the output is at most one greater than the depth of any input. +For the join case, the number of in-edges can be no greater than the join width, which itself is bounded by $k$. The depth thus increases by at most a constant factor of $\lceil \log(k) \rceil = O_k(1)$. +For the projection case, observe that the fan-in is bounded by $|\query'(\dbbase)|$, which is in turn bounded by $n^k$. The depth increase for any projection node is thus at most $\lceil \log(n^k)\rceil = O(k\log(n)) = O_k(\log(n))$. +\qed +\end{proof} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsubsection{Circuit size vs. runtime} +\label{sec:circuit-runtime} + \begin{Lemma}\label{lem:circ-model-runtime} \label{lem:circuits-model-runtime} Given a \abbrNXPDB $\pxdb$ with \dbbaseName $\dbbase$, and query plan $Q$, the runtime of $Q$ over $\dbbase$ has the same or greater complexity as the size of the lineage of $Q(\pxdb)$. That is, we have $\abs{V_{Q,\pxdb}} \leq (k-1)\qruntime{Q, \dbbase}+1$, where $k$ is the maximal degree of any polynomial in $Q(\pxdb)$. @@ -248,6 +274,9 @@ The property holds for all recursive queries, and the proof holds. \qed \end{proof} +\subsubsection{Runtime of \abbrStepOne} +\label{sec:lc-runtime} + We next need to show that we can construct the circuit in time linear in the deterministic runtime. \begin{lemma}\label{lem:tlc-is-the-same-as-det} Given a query $\query$ over a \dbbaseName $\dbbase$, the runtime $\timeOf{\abbrStepOne}(\query,\dbbase,\circuit) \le O(\qruntime{\query, \dbbase})$