Background ------------------ I found that performing a "select cols from mytable where X like 'foo %' was dog slow on my postgresql database. Analysing the query plan showed that, although X was indexed, the query was always performing a table scan.
The database uses UTF-8 encoding, and after a bit of research, I found that I had to define a second index on X, using 'pattern_ops' (as described in Postgresql 8.3 manual section 11.9): CREATE INDEX new_index on mytable (X varchar_pattern_ops). That did the right thing and sorted out the performance problem. Question -------------- Is there a way that I can specify pattern_ops in the index definition within SqlAlchemy? If not, is postgres.py/PGSchemaGenerator.visit_index the right place for me to have a go at hacking something? Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---