Synonyms
Ranking queries; Top-n queries
Definition
A top-k query retrieves up to k query answers with the highest (lowest) score according to some scoring function f, where ties are resolved arbitrarily. Without loss of generality, we assume that we retrieve the results with highest scores. In other words, top-k queries return a subset of the query answers S ⊂ Q such that
On relational data, two popular variants of top-k queries are defined: (1) top-k join query and (2) top-k aggregate query.
Top-k Join Query. Consider a set of relations R1 . . . Rn. A top-k join query joins R1 . . . Rn and returns the k join results with the largest combined scores. The combined score of each join result is computed according to some function F(p1, … , pm), where p1 , … , pm are scoring predicates defined over the join results.
An example SQL template for a top-k join query is:
SELECT < select...
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Section Editor information
Rights and permissions
Copyright information
© 2018 Springer Science+Business Media, LLC, part of Springer Nature
About this entry
Cite this entry
Ilyas, I.F. (2018). Top-k Queries. In: Liu, L., Özsu, M.T. (eds) Encyclopedia of Database Systems. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-8265-9_3843
Download citation
DOI: https://doi.org/10.1007/978-1-4614-8265-9_3843
Published:
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4614-8266-6
Online ISBN: 978-1-4614-8265-9
eBook Packages: Computer ScienceReference Module Computer Science and Engineering