'Performance of 'NULLS FIRST' in postgres select query
I'm using postgres db. I want to display records with nulls before the rest of results. Is it good practice to use NULLS FIRST on large amount of data?
... ORDER BY last_updated NULLS FIRST
Is there any better solution?
Solution 1:[1]
You can create an index to support that order by:
create index on the_table (last_updated ASC NULLS FIRST)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | a_horse_with_no_name |
