Performance of 'NULLS FIRST' in postgres select query

91 views Asked by At

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?

1

There are 1 answers

2
AudioBubble On

You can create an index to support that order by:

create index on the_table (last_updated ASC NULLS FIRST)