Case insensitive filter
I have a table that stores file paths and it has about 80 million rows
and I'm trying to optimize case insensitive SELECT queries.
I have created an index on the lower() of the path column:
CREATE INDEX lower_path_idx ON file_table ((lower(path)));
A well constructed query like the one below uses the index properly:
SELECT * FROM file_table WHERE LOWER(path) = '/path/to/file';
However, if I use the iexact filter, it ends up as ILIKE in SQL which
does not use the index. Is there any way with the ORM to use this
index or will I have to resort to raw queries?
I'm using Postgres 8.4 and Django 1.2.5.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home