14
Views
1
Comments
Solved
What column order does this OS doc mean?
Question

Hi, there

I read this in https://success.outsystems.com/documentation/best_practices/performance_and_monitoring/performance_best_practices_data_model/:

My question is what column orders - is it in entity or where - does it mean?

regards and thanks

2023-12-16 19-57-03
Sanjay Kushwah
Solution

Hi @ibox,

When multiple columns are used in an index, the order in which they are listed matters. This is because indexes work by storing values in a sorted order, and searching based on multiple columns is most efficient when those columns are already sorted in the same order you're searching for.


Example:

Imagine you have an index on (age, marks). This means the index is sorted first by age, and then within each value of age, it's further sorted by marks.

If you then search for rows where age = 5 AND marks = 10, the database can efficiently find matching rows because the index already has the data sorted in that order. However, if you searched for marks = 10 AND age = 5, the index wouldn't be as helpful because it's not sorted in that order.


Kind regards,

Sanjay Kushwah

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.