From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Jon Valvatne <jon(at)valvatne(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Postgres doesn't use indexes for prefix matching? |
Date: | 2004-07-08 17:43:56 |
Message-ID: | 20040708104125.N97290@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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).
From | Date | Subject | |
---|---|---|---|
Next Message | Edmund Dengler | 2004-07-08 18:12:53 | Re: Enough RAM for entire Database.. cost aside, is this |
Previous Message | wespvp | 2004-07-08 17:30:39 | Re: Postgres doesn't use indexes for prefix matching? |