views:

94

answers:

1

I'm running a case-insensitive search on a table with 7.2 million rows, and I was wondering if there was any way to make this query any faster?

Currently, it takes approx 11.6 seconds to execute, with just one search parameter, and I'm worried that as soon as I add more than one, this query will become massively slow.

SELECT count(*)
FROM "exif_parse"
WHERE (description ~* 'canon')

---Edit---

phpPgAdmin tells me that there is an index on this column as defined below:

desc_idx    CREATE INDEX desc_idx ON exif_parse USING btree (description)

--- Edit 2----

The database contains records in this format:

imaage_id    exif_field    description

And I am running against description as a search, so it contains data from a Tone Curve (0, 0, 32, 22, 64, 56, 128, 128, 192, 196, 255, 255) to Lens (Pentax-F FISH-EYE 1:3.5-4.5 17-28mm) to Make (Canon EOS REBEL XSi)

+4  A: 

You should look at using FTS.

OMG Ponies
@OMG Ponies Do you perhaps have a better example of this? I looked through this document, and did a bit of Google research that wasn't really helpful. I'm quite new to PostgreSQL, coming from MySQL.
Ben Dauphinee
OMG Ponies