﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19441	No Postgres _like index when unique=True	Dylan Verheul	nobody	"{{{
class Species(models.Model):
    scientific_name = models.CharField(max_length=200, db_index=True)
}}}

Generates 2 indexes:
{{{
BEGIN;
CREATE INDEX ""species_species_scientific_name"" ON ""species_species"" (""scientific_name"");
CREATE INDEX ""species_species_scientific_name_like"" ON ""species_species"" (""scientific_name"" varchar_pattern_ops);

COMMIT;
}}}

{{{
class Species(models.Model):
    scientific_name = models.CharField(max_length=200, unique=True, db_index=True)
}}}
...does not create any indexes, because it depends on UNIQUE, but it SHOULD generate the index:

{{{CREATE INDEX ""species_species_scientific_name_like"" ON ""species_species"" (""scientific_name"" varchar_pattern_ops);}}}

to make sure Postgres is optimized for LIKE operator."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	postgresql		Ready for checkin	1	0	0	0	0	0
