SELECT speed with LIKE - Mailing list pgsql-general

From JB
Subject SELECT speed with LIKE
Date
Msg-id 38E64108.36606AE9@kw.igs.net
Whole thread Raw
Responses Re: SELECT speed with LIKE
Re: SELECT speed with LIKE
Re: SELECT speed with LIKE
List pgsql-general
I've got a real problem with the speed of a select. Some folk might
recall a prev post about a month ago about this 50MB table taking 20+
seconds to complete a query. This table has about 70,000 records in it.
The table has a field called 'stname char(17)' which is indexed. The
query is "SELECT * FROM data WHERE stname LIKE 'MAIN%'". I'm running on
Redhat 6.1, 128MB ram, 40GB, P350. The actual index file is 4 MB.
EXPLAIN tells that it will use the index. The thing still takes about 20
seconds to complete. Can anyone make some suggestions on how I can speed
this up? It seems like such a simple problem I can't see the solution.
Any help would be most appreciated as this abosolutly has to be fixed
and I don't want to have to convert to another DB.

BTW I've run the same thing on a similar machine with 64 MB ram and it
take over a minute to complete. EXPLAIN says...

NOTICE: QUERY PLAN:
Index Scan using nx_data2 on data (cost=3352.28 rows=1 width=440)
EXPLAIN

jim

--
Get hold of portable property.  -- Charles Dickens, "Great Expectations"

pgsql-general by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [INTERFACES] Problem with Large Object Interface ofpgsql_perl5
Next
From: "Nilesh A. Phadke"
Date:
Subject: Embedded SQL -- ecpg