Skyline operator explained
The skyline operator is the subject of an optimization problem and computes the Pareto optimum on tuples with multiple dimensions.
This operator is an extension to SQL proposed by Börzsönyi et al.[1] to filter results from a database to keep only those objects that are not worse in multiple dimensions than any other.The name skyline comes from the view on Manhattan from the Hudson River, where those buildings can be seen that are not hidden by any other. A building is visible if it is not dominated by a building that is taller or closer to the river (two dimensions, distance to the river minimized, height maximized).Another application of the skyline operator involves selecting a hotel for a holiday. The user wants the hotel to be both cheap and close to the beach. However, hotels that are close to the beach may also be expensive. In this case, the skyline operator would only present those hotels that are not worse than any other hotel in both price and distance to the beach.
Formal specification
The skyline operator returns tuples that are not dominated by any other tuple. A tuple dominates another if it is at least as good in all dimensions and better in at least one dimension. Formally, we can think of each tuple as a vector
.
dominates
(written:
) if
is at least as good as
in every dimension, and superior in at least one:
[2] Dominance (
) can be defined as any
strict partial ordering, for example greater (with
and
) or less (with
and
).
Assuming two dimensions and defining dominance in both dimensions as greater, we can compute the skyline in SQL-92 as follows:WITH tuples(id, i, j) as (values(1,1,1), (1,2,1), (1,1,2))SELECT * FROM tuples t1WHERE NOT EXISTS (-- which is not dominated by SELECT * FROM tuples t2 -- a tuple that is WHERE t2.i >= t1.i and t2.j >= t1.j -- at least as good in all dimensions AND (t2.i > t1.i or t2.j > t1.j) -- and better in at least one dimension);
Proposed syntax
As an extension to SQL, Börzsönyi et al.[1] proposed the following syntax for the skyline operator:
SELECT ... FROM ... WHERE ...GROUP BY ... HAVING ...SKYLINE OF [DISTINCT] d1 [MIN | MAX | DIFF], ..., dm [MIN | MAX | DIFF]ORDER BY ...where d1, ... dm denote the dimensions of the skyline and MIN, MAX and DIFF specify whether the value in that dimension should be minimised, maximised or simply be different.
Without an SQL extension, the SQL query requires an antijoin with not exists
:SELECT ... FROM (...) q WHERE NOT EXISTS (SELECT * FROM (...) p WHERE p.d1 [<= | >=] q.d1 AND ... AND p.dm [<= | >=] q.dm AND (p.d1 [< | >] q.d1 OR ... OR p.dm [< | > ] q.dm))
Implementation
The skyline operator can be implemented directly in SQL using current SQL constructs, but this has been shown to be very slow in disk-based database systems.[1] Other algorithms have been proposed that make use of divide and conquer, indices,[1] MapReduce[3] and general-purpose computing on graphics cards.[4] Skyline queries on data streams (i.e. continuous skyline queries) have been studied in the context of parallel query processing on multicores, owing to their wide diffusion in real-time decision making problems and data streaming analytics.[5]
See also
References
- Book: Borzsonyi. Stephan. Kossmann. Donald. Stocker. Konrad. Proceedings 17th International Conference on Data Engineering . The Skyline operator . 2001. 421–430. 10.1109/ICDE.2001.914855. 0-7695-1001-9. 5812098.
- Book: Maximilian E. Schüle, Alex Kulikov, Alfons Kemper, Thomas Neumann. New Trends in Databases and Information Systems - ADBIS 2020 Short Papers, Lyon, France, August 25-27, 2020, Proceedings . ARTful Skyline Computation for In-Memory Database Systems . Communications in Computer and Information Science . 2020. 1259 . 3–12 . 10.1007/978-3-030-54623-6_1. 978-3-030-54622-9 . English.
- Mullesgaard. Kasper. Pedersen. Jens Laurits. Lu. Hua. Zhou. Yongluan. Efficient Skyline Computation in MapReduce. Proc. 17th International Conference on Extending Database Technology (EDBT). 2014. 37–48.
- Book: Bøgh. Kenneth S. Assent. Ira. Magnani. Matteo. Proceedings of the Ninth International Workshop on Data Management on New Hardware . Efficient GPU-based skyline computation . 2013. 5:1–5:6. 10.1145/2485278.2485283. 9781450321969. 13195757.
- De Matteis. Tiziano. Di Girolamo. Salvatore. Mencagli. Gabriele. Continuous skyline queries on multicore architectures. Concurrency and Computation: Practice and Experience. 25 August 2016. 28. 12. 3503–3522. 10.1002/cpe.3866. 6562372.