datacamp icon indicating copy to clipboard operation
datacamp copied to clipboard

Very slow sorting

Open vojto opened this issue 16 years ago • 2 comments

Sorting is very slow, because it doesn't use index.

Normally, we could do just something like this: ORDER BY column ASC

But we want to put NULLs at the end of the list, so we're using something like this: ORDER BY column IS NULL ASC, column

This is very slow. Another solution I thought could work would be WHERE column IS NOT NULL ORDER BY column ASC

This wouldn't select rows where column picked for ordering is NULL. This is still pretty fast, but of course I'm not sure if it's ok to just hide rows where selected row for ordering is NULL.

vojto avatar Apr 08 '10 13:04 vojto