pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ibrahim Tekin <itekin@gmail.com>
To: mark@mark.mielke.cc <mark@mark.mielke.cc>
Cc: pgsql-performance@postgresql.org
Subject: Re: LIKE query on indexes
Date: Tue, 21 Feb 2006 22:12:17 +0200
Message-ID: <e4dcba670602211212i523ad54bh404bc1097f90ef6f@mail.gmail.com> (raw)
In-Reply-To: <20060221174048.GA8108@mark.mielke.cc>
References: <e4dcba670602210757n2caf7c15t2a93353c9081c51f@mail.gmail.com>
	<20060221174048.GA8108@mark.mielke.cc>

my database encoding is unicode.
i have two table, one is 3.64gb on hdd and has 2.2 million records. it takes
140 secs to run on my AMD Turion 64 M 800MHz/1GB laptop.
second table is 1.2gb, 220000 records, and takes 56 secs to run.

explain says 'Seq Scan on mytable, ..'

On 2/21/06, mark@mark.mielke.cc <mark@mark.mielke.cc> wrote:
>
> On Tue, Feb 21, 2006 at 05:57:12PM +0200, Ibrahim Tekin wrote:
> > i have btree index on a text type field. i want see rows which starts
> with
> > certain characters on that field. so i write a query like this:
> >     SELECT * FROM mytable WHERE myfield LIKE 'john%'
> > since this condition is from start of the field, query planner should
> use
> > index to find such elements but explain command shows me it will do a
> > sequential scan.
> > is this lack of a feature or i am wrong somewhere?
>
> Is the query fast enough? How big is your table? What does explain
> analyze select tell you?
>
> Cheers,
> mark
>
> --
> mark@mielke.cc / markm@ncf.ca / markm@nortel.com
> __________________________
> .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
> |\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   |
> |  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario,
> Canada
>
>   One ring to rule them all, one ring to find them, one ring to bring them
> all
>                        and in the darkness bind them...
>
>                            http://mark.mielke.cc/
>
>

view thread (9+ messages)  latest in thread

Message-ID: <e4dcba670602211212i523ad54bh404bc1097f90ef6f@mail.gmail.com>
Permalink:  ../e4dcba670602211212i523ad54bh404bc1097f90ef6f@mail.gmail.com/
Also on:    postgresql.org/message-id/e4dcba670602211212i523ad54bh404bc1097f90ef6f@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: itekin@gmail.com, mark@mark.mielke.cc
  Subject: Re: LIKE query on indexes
  In-Reply-To: <e4dcba670602211212i523ad54bh404bc1097f90ef6f@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox