Meta-SQL: Towards Practical Meta-Querying
Enterprise databases often contain not only ordinary data, but also queries. Examples are view definitions in the system catalog; usage logs or workloads; and stored procedures as in SQL/PSM or Postgres. Unfortunately, these queries are typically stored as long strings, which makes it hard to use standard SQL to express meta-queries: queries about queries. Meta-querying is an important activity in situations such as advanced database administration, database usage monitoring, and workload analysis. Here are some examples of meta-queries to a usage log. (i) “Which queries in the log do the most joins?” (ii) “Which queries in the log return an empty answer on the current instance of the database?” (iii) View expansion: “Replace, in each query in the log, each view name by its definition as given in the system catalog.” (iv) Given a list of new view definitions (under the old names): “Which queries in the log give a different answer on the current instance under the new view definitions?”
KeywordsSyntax Tree Type String XPath Expression Current Instance View Definition
Unable to display preview. Download preview PDF.