From: Josh Berkus <josh@agliodbs.com>
To: Dan Harris <fbsd@drivefaster.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query tuning help
Date: Sun, 8 May 2005 17:48:18 -0700
Message-ID: <200505081748.18362.josh@agliodbs.com> (raw)
In-Reply-To: <924ac6c029f5453c442eacdda06b132c@drivefaster.net>
References: <924ac6c029f5453c442eacdda06b132c@drivefaster.net>
Dan,
> and ( recordtext like '%RED%' or recordtext like '%CORVETTE%' )
It is simply not possible to use B-tree indexes on these kind of text queries.
B-trees require you to start at the "left" side of the field, because B-trees
locate records via <> tests. "Anywhere in the field" text search requires a
Full Text Index.
> The reason for the redundant LIKE clause is that first, I only want
> those "incidentid"s that contain the words 'RED' and 'CORVETTE'. BUT,
> those two words may exist across multiple records with the same
> incidentid. Then, I only want to actually work with the rows that
> contain one of the words. This query will repeat the same logic for
> however many keywords are entered by the user. I have investigated
> text searching options and have not found them to be congruous with my
> application.
Sounds like you either need to restructure your application, restructure your
database (so that you're not doing "anywhere in field" searches), or buy 32GB
of ram so that you can cache the whole table.
--
Josh Berkus
Aglio Database Solutions
San Francisco
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: josh@agliodbs.com, fbsd@drivefaster.net
Subject: Re: Query tuning help
In-Reply-To: <200505081748.18362.josh@agliodbs.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