Re: PostgreSQL - 'SKYLINE OF' clause added! - Mailing list pgsql-hackers
From | ranbeer makin |
---|---|
Subject | Re: PostgreSQL - 'SKYLINE OF' clause added! |
Date | |
Msg-id | a0eedc000703030612g2ffeddafib2f60a0aa915107c@mail.gmail.com Whole thread Raw |
In response to | Re: PostgreSQL - 'SKYLINE OF' clause added! (Martijn van Oosterhout <kleptog@svana.org>) |
Responses |
Re: PostgreSQL - 'SKYLINE OF' clause added!
|
List | pgsql-hackers |
Here is a description of what the SKYLINE operator is:
---
Suppose you wish to purchase books and you are looking for books with high rating and low price. However, both the criteria of selecting books are complementary since books of higher rating are generally more expensive. For finding such books, you'll query the database system of the book store which will return a set of interesting books. The word 'interesting' implies all the books which are as good or better in both the dimensions (rating and price) and better in at least one dimension. This set of interesting points forms the Skyline.
Skyline operator finds points which are not dominated by other data points. A point dominates another point if it is as good or better in all dimensions and better in at least one dimension.
For specifying the Skyline queries, we extend SQL SELECT statement by an optional SKYLINE OF clause as given below:
SELECT ... FROM ... WHERE...
GROUP BY ... HAVING...
SKYLINE OF [DISTINCT] d1 [MIN | MAX | DIFF], .., dm [MIN | MAX | DIFF]
ORDER BY...
Where, d1, d2 ,…, dm denote the dimensions of the Skyline, and MIN, MAX, DIFF specify whether the value in that dimension should be minimized, maximized, or simply be different. When DIFF is specified, two tuples are compared only if the value of the attribute on which DIFF is applied is different.
When DISTINCT clause is specified and if there are two or more tuples with the same values of skyline attributes, then only one of them is retained in the skyline set. Otherwise, all of them are retained.
Let's consider the above example of purchasing books with high rating and low price.
Book Name | Rating (out of 5) | Price (Rs) |
Prodigal Daughter | 3 | 250 |
The city of Joy | 5 | 400 |
Vanishing Acts | 2 | 250 |
The Notebook | 4 | 300 |
Fountain Head | 5 | 350 |
Dear John | 5 | 500 |
Table1. Sample of book database
Now, in order to get books with high rating and low price, you simply can issue the following query:
SELECT *
FROM Books
SKYLINE OF rating MAX, price MIN;
The Skyline set returned will be:
Book Name | Rating (out of 5) | Price (Rs) |
Prodigal Daughter | 3 | 250 |
The Notebook | 4 | 300 |
Fountain Head | 5 | 350 |
Table2. Skyline set
From this set, you can now make your choice of books, by weighing your personal preferences for price and rating of the books.
For more information, you can refer to:
S. Borzsonyi, D. Kossmann, and K. Stocker. The skyline operator. In ICDE, pages 421.430, 2001
---
Thanks.
On Sat, Mar 03, 2007 at 07:02:41PM +0530, ranbeer makin wrote:
> We at International Institute of Information Technology (IIIT) Hyderabad,
> India, have extended the Postgres database
> system with the skyline operation. For this work, we were guided by our
> Prof. Kamalakar Karlapalem
> (http://www.iiit.ac.in/~kamal/).
<snip>
> Can this piece of work contribute to PostgreSQL? If yes, then we'll send out
> a detailed report of this project including changes
> made, issues involved/need to be solved, limitations, future work, and the
> source code etc.
Well, that kind of depends. I have no idea what "Skyline" means so
telling us what it is would be a good start
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFF6XrkIB7bNG8LQkwRAqw8AJ0UKAy41OMxdgLUdY1G+e7R6/jGPwCZAQY4
9uCKFUW65UBIx7fpogR75Yo=
=6Yc0
-----END PGP SIGNATURE-----
pgsql-hackers by date: