Open denschub opened 9 years ago
can you send a PR with this migration ?
Sure, I could simply add a unique index to the lowercased tag names, but this will create issues with setups not using enforced lowercased tag names. What's the best approach to add setup-dependent indexes in your setup?
I think PG will ignore the index if the setup don't use it.
Creating a unique index on non-unique datasets will raise a bunch of errors.
Right, good catch. What about adding a commented migration and we explain the issue ?
Pull request #498 introduced a lowercased tag checking by using database functions. However, this causes a miss of
index_tags_on_name
on PostgreSQL, which results in a very bad performance. Creating an index on lowercased tag names (CREATE UNIQUE INDEX index_tags_on_lower_name on tags (lower(name));
) solves the problem.Tag loading without
LOWER()
Tag loading with
LOWER()
Tag loading with
LOWER()
and added index