#community-help

Understanding Default Sorting and Performance Impact in Schema

TLDR Ricardo asked about the default sorting field and the performance impact of sort_by. Jason explained the defaults and potential performance cost when sorting by multiple fields.

Powered by Struct AI
+12
7
27mo
Solved
Join the chat
Jun 03, 2021 (27 months ago)
Ricardo
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Ricardo
06:40 PM
if no default_sorting_field is provided in the schema what's the order returned? insertion order?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:44 PM
_text_match:desc by default (textual relevance) and if there's a tie, then insertion order, yes
Ricardo
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Ricardo
06:45 PM
ok, cool cause in my case the query is empty
06:45
Ricardo
06:45 PM
thanks
+11
06:46
Ricardo
06:46 PM
how much does sort_by impact performance?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:47 PM
There's some level of sorting always happening when results are returned - we need to order results somehow
06:49
Jason
06:49 PM
Where you might see a performance cost is when you sort by multiple fields and a lot of record tie on fields earlier in the sort_by list, so additional fields need to be used for tie-breaking
+11