4
For default, relational databases create indices using increasingly ordered binary tree structures. But there is the possibility of creating it in a decreasing way too.
My question is whether (and when) it is recommended to use it. For example:
SELECT nome
FROM pessoa
WHERE data_cadastro >= '2014-01-01'
ORDER BY data_cadastro DESC
In the above SQL, considering the WHERE
and ORDER BY
, a decreasing index in the column data_cadastro
would improve performance?
Why did they try to close that question ?
– gmsantos
@gmsantos The reason chosen was "Based on Opinions"
– user7261
Well I put an answer trying to explain the basics of how sorting will affect selects and Inserts. I believe that this is within the scope of the OP question and is not based on "personal opinion" but on facts of how the indexes work
– jean
Exactly, @jean. I believe you were wrong to vote to close.
– gmsantos