On Fri, 2 Jul 2004, Jon Valvatne wrote: > Pasted below, I demonstrate two queries which both produce the same two > records in their result set (the two objects which have my full name in > their name field). Based on my experiences with other DBMS, I would have > thought Postgres could do a simple index scan for both queries and thus > produce the results equally fast in both cases, but not so. In the > second case it fails to use the index, falling back to filtering a slow > sequential scan. > > I can't seem to find anything in the manual about this, but I'm sure > I've read several places that Postgres can do what I want here. The only > place I can dig up right now is in contrib/fulltextindex/README.fti, > which mentions: "If a ~ search starts with a ^ (match start of string), > btree indices can be used by PostgreSQL." > > Is there something I am doing wrong?
Prefix matching using indexes is available in "C" locale or if you have an index in a special opclass (<something>_pattern_ops -- I think the operator class part of the docs describe them). ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster