Skip to main content

Top-k Queries

  • Reference work entry
  • First Online:
Encyclopedia of Database Systems
  • 24 Accesses

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

$$ \left|S\right|{\le} k\bigwedge \forall t{\in} S\nexists r{\in} \left(Q{-}S\right)\bigwedge F(r){>}F(t) $$

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...

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 4,499.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 6,499.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ihab F. Ilyas .

Editor information

Editors and Affiliations

Section Editor information

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer Science+Business Media, LLC, part of Springer Nature

About this entry

Check for updates. Verify currency and authenticity via CrossMark

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

Publish with us

Policies and ethics