docker-odoo-project
docker-odoo-project copied to clipboard
[proposal] Default database collation to collate=C
When a database is created by the container's entrypoint, it uses the default collation that will be en_US.utf8.
As discussed here: https://github.com/odoo/odoo/pull/25196#issuecomment-396683972, this may be under-optimized with the use of LIKE queries using wildcards (LIKE 'foo%').
We have several possible axes of improvements:
- add text_pattern_ops case by case where necessary
- add trigram indices using pg_trgm which benefits for LIKE '%foo%' queries as well, case by case too however
- create the databases with a C collation and locale en_US.utf8 (collate=C)
This is mainly the last point which should be discussed here.
Pros:
- consistent sorting
- expected general improvement of performance
Cons:
- sorting of accented chars "sounds" wrong for French: Blanche, Béatrice, Claude is going to be sorted as Blanche, Béatrice, Claude instead of Béatrice, Blanche, Claude. Can be resolved with unaccent
My proposal is to change the calls to createdb in the image to always create them with collate=C.
@sebastienbeau @rvalyi would you agree with this change? An alternative would be to be able to configure it from a variable, but if the change is fine for everybody, let's keep it simple :)
@sebastienbeau ping
Version 13.0 is particularly affected by this, as child_of uses LIKE '1/8/%' for hierarchies.
We must do this.