From: | aa <ghevge(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Is there any chance to get some kind of a result set sifting mechanism in Postgres? |
Date: | 2024-05-11 12:19:49 |
Message-ID: | CA+hGcwLhiGaN0PjrkmKdOyQmfEZ-zWt8VTT0d0L70j6O4GdZNw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello Everyone!
Is there any chance to get some kind of a result set sifting mechanism in
Postgres?
What I am looking for is a way to get for example: "nulls last" in a result
set, without having to call "order by" or having to use UNION ALL, and if
possible to get this in a single result set pass.
Something on this line: SELECT a, b, c FROM my_table WHERE a nulls last
OFFSET 0 LIMIT 25
I don't want to use order by or union all because these are time consuming
operations, especially on large data sets and when comparations are done
on dynamic values (eg: geolocation distances in between a mobile and a
static location)
What I would expect from such a feature, will be speeds comparable with non
sorted selects, while getting a very rudimentary ordering.
A use case for such a mechanism will be the implementation of QUICK
relevant search results for a search engine.
I'm not familiar with how Postgres logic handles simple select queries, but
the way I would envision a result set sifting logic, would be to collect
the result set, in 2 separate lists, based on the sifting condition, and
then concatenate these 2 lists and return the result, when the pagination
requests conditions are met.
Any idea if such a functionality is feasible ?
Thank you.
PS: if ever implemented, the sifting mechanism could be extended to
accommodate any type of thresholds, not just null values.
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Koval | 2024-05-11 13:19:38 | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Previous Message | Alvaro Herrera | 2024-05-11 09:40:01 | Re: cataloguing NOT NULL constraints |