Nikolaos Tziavelis, Wolfgang Gatterbauer, Mirek Riedewald
{"title":"数据库查询的排序枚举","authors":"Nikolaos Tziavelis, Wolfgang Gatterbauer, Mirek Riedewald","doi":"arxiv-2409.08142","DOIUrl":null,"url":null,"abstract":"Ranked enumeration is a query-answering paradigm where the query answers are\nreturned incrementally in order of importance (instead of returning all answers\nat once). Importance is defined by a ranking function that can be specific to\nthe application, but typically involves either a lexicographic order (e.g.,\n\"ORDER BY R.A, S.B\" in SQL) or a weighted sum of attributes (e.g., \"ORDER BY\n3*R.A + 2*S.B\"). We recently introduced any-k algorithms for (multi-way) join\nqueries, which push ranking into joins and avoid materializing intermediate\nresults until necessary. The top-ranked answers are returned asymptotically\nfaster than the common join-then-rank approach of database systems, resulting\nin orders-of-magnitude speedup in practice. In addition to their practical usefulness, our techniques complement a long\nline of theoretical research on unranked enumeration, where answers are also\nreturned incrementally, but with no explicit ordering requirement. For a broad\nclass of ranking functions with certain monotonicity properties, including\nlexicographic orders and sum-based rankings, the ordering requirement\nsurprisingly does not increase the asymptotic time or space complexity, apart\nfrom logarithmic factors. A key insight of our work is the connection between ranked enumeration for\ndatabase queries and the fundamental task of computing the kth-shortest path in\na graph. Uncovering these connections allowed us to ground our approach in the\nrich literature of that problem and connect ideas that had been explored in\nisolation before. In this article, we adopt a pragmatic approach and present a\nslightly simplified version of the algorithm without the shortest-path\ninterpretation. We believe that this will benefit practitioners looking to\nimplement and optimize any-k approaches.","PeriodicalId":501123,"journal":{"name":"arXiv - CS - Databases","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2024-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Ranked Enumeration for Database Queries\",\"authors\":\"Nikolaos Tziavelis, Wolfgang Gatterbauer, Mirek Riedewald\",\"doi\":\"arxiv-2409.08142\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Ranked enumeration is a query-answering paradigm where the query answers are\\nreturned incrementally in order of importance (instead of returning all answers\\nat once). Importance is defined by a ranking function that can be specific to\\nthe application, but typically involves either a lexicographic order (e.g.,\\n\\\"ORDER BY R.A, S.B\\\" in SQL) or a weighted sum of attributes (e.g., \\\"ORDER BY\\n3*R.A + 2*S.B\\\"). We recently introduced any-k algorithms for (multi-way) join\\nqueries, which push ranking into joins and avoid materializing intermediate\\nresults until necessary. The top-ranked answers are returned asymptotically\\nfaster than the common join-then-rank approach of database systems, resulting\\nin orders-of-magnitude speedup in practice. In addition to their practical usefulness, our techniques complement a long\\nline of theoretical research on unranked enumeration, where answers are also\\nreturned incrementally, but with no explicit ordering requirement. For a broad\\nclass of ranking functions with certain monotonicity properties, including\\nlexicographic orders and sum-based rankings, the ordering requirement\\nsurprisingly does not increase the asymptotic time or space complexity, apart\\nfrom logarithmic factors. A key insight of our work is the connection between ranked enumeration for\\ndatabase queries and the fundamental task of computing the kth-shortest path in\\na graph. Uncovering these connections allowed us to ground our approach in the\\nrich literature of that problem and connect ideas that had been explored in\\nisolation before. In this article, we adopt a pragmatic approach and present a\\nslightly simplified version of the algorithm without the shortest-path\\ninterpretation. We believe that this will benefit practitioners looking to\\nimplement and optimize any-k approaches.\",\"PeriodicalId\":501123,\"journal\":{\"name\":\"arXiv - CS - Databases\",\"volume\":null,\"pages\":null},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-09-12\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Databases\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2409.08142\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Databases","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2409.08142","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
摘要
排序枚举是一种查询回答范例,在这种范例中,查询答案按重要性顺序逐步返回(而不是一次性返回所有答案)。重要性由一个排序函数来定义,该函数可以是特定于应用的,但通常涉及一个词法排序(例如,SQL 中的 "ORDER BY R.A,S.B")或一个属性加权和(例如,"ORDER BY3*R.A + 2*S.B")。我们最近为(多向)连接查询引入了 any-k 算法,它将排序推入连接,并在必要时避免中间结果的具体化。与数据库系统中常见的先连接后排名的方法相比,排名靠前的答案的返回速度在渐近上更快,从而在实践中实现了数量级的提速。除了实用性之外,我们的技术也是对无排序枚举理论研究的补充,在无排序枚举中,答案也是逐步返回的,但没有明确的排序要求。对于一类具有某些单调性的排序函数,包括线性排序和基于和的排序,除了对数因素外,排序要求出人意料地没有增加渐进时间或空间复杂性。我们工作的一个关键见解是数据库查询的排序枚举与计算图中第 k 条最短路径这一基本任务之间的联系。发现这些联系使我们能够将我们的方法建立在有关该问题的丰富文献基础之上,并将以前孤立探索过的观点联系起来。在本文中,我们采用了一种务实的方法,提出了一个略微简化的算法版本,但没有对最短路径进行解释。我们相信,这将有益于希望实施和优化任意 K 方法的实践者。
Ranked enumeration is a query-answering paradigm where the query answers are
returned incrementally in order of importance (instead of returning all answers
at once). Importance is defined by a ranking function that can be specific to
the application, but typically involves either a lexicographic order (e.g.,
"ORDER BY R.A, S.B" in SQL) or a weighted sum of attributes (e.g., "ORDER BY
3*R.A + 2*S.B"). We recently introduced any-k algorithms for (multi-way) join
queries, which push ranking into joins and avoid materializing intermediate
results until necessary. The top-ranked answers are returned asymptotically
faster than the common join-then-rank approach of database systems, resulting
in orders-of-magnitude speedup in practice. In addition to their practical usefulness, our techniques complement a long
line of theoretical research on unranked enumeration, where answers are also
returned incrementally, but with no explicit ordering requirement. For a broad
class of ranking functions with certain monotonicity properties, including
lexicographic orders and sum-based rankings, the ordering requirement
surprisingly does not increase the asymptotic time or space complexity, apart
from logarithmic factors. A key insight of our work is the connection between ranked enumeration for
database queries and the fundamental task of computing the kth-shortest path in
a graph. Uncovering these connections allowed us to ground our approach in the
rich literature of that problem and connect ideas that had been explored in
isolation before. In this article, we adopt a pragmatic approach and present a
slightly simplified version of the algorithm without the shortest-path
interpretation. We believe that this will benefit practitioners looking to
implement and optimize any-k approaches.