Optimizing ORDER BY by removing unnecessary CASTing of types
|Reported by:||srokap||Owned by:|
Previously discuissed here: https://docs.google.com/document/d/1NrxIj4YOTjNbeXDGW3tpz2lNvaRwL2NDPBNd7TgRfFk/edit?disco=AAAAAEr6svk
Me: CAST in ORDER BY statement seems to force filesorting anyway. Better to allow different metadata types than force only text values
Evan: I think we ought to push metastring values into the metadata table, and leave metastrings for denormalizing the keys. Then, on metadata save, we would save both the int value and the string value in two columns. I have this clear in my mind but I'm not sure if my explanation is getting it across.
Me: I had very similar solution in mind! It solves also problem with selecting entities without particular value - it will be possible now. I'm for this idea.
So we want in this ticket to
- move VALUES if metadata to metadata table instead of utilizing metastrings
- store integer value of the field in separate column and use it for ordering instead of casting text to int