Re: Query tuning help - Mailing list pgsql-performance

From Dan Harris
Subject Re: Query tuning help
Date
Msg-id 7fc67646a961f5ebef90def7aeb95fd0@drivefaster.net
Whole thread Raw
In response to Re: Query tuning help  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Query tuning help
List pgsql-performance
On May 8, 2005, at 8:06 PM, Josh Berkus wrote:
>
>> If I were to use tsearch2 for full-text indexing, would I need to
>> create another table that merges all of my recordtext rows into a
>> single 'text' field type?
>
> No.   Read the OpenFTS docs, they are fairly clear on how to set up a
> simple
> FTS index. (TSearch2 ~~ OpenFTS)
>
>> If so, this is where I run into problems, as
>> my logic also needs to match multiple words in their original order.

I have been reading the Tsearch2 docs and either I don't understand
something or I'm not communicating my situation clearly enough.  It
seems that Tsearch2 has a concept of "document".  And, in everything I
am reading, they expect your "document" to be all contained in a single
row.  Since my words can be spread across multiple rows, I don't see
that Tsearch2 will combine all 'recordtext' row values with the same
"incidentid" into a single vector.  Am I overlooking something in the
docs?

>
> I'm doing something fairly similar on one of my projects and it works
> very
> well.
>

I'd be curious what similarities they have?  Is it the searching across
multiple rows or the order of words?

> The limitations on TSearch2 indexes are:
> 1) they are expensive to update, so your data loads would be noticably
> slower.
> 2) they are only fast when cached in RAM (and when cached, are *very*
> fast).
> So if you have a variety of other processes that tend to fill up RAM
> between
> searches, you may find them less useful.
> 3) You have to create a materialized index column next to recordtext,
> which
> will increase the size of the table.

Duly noted.  If this method can search across rows, I'm willing to
accept this overhead for the speed it would add.

In the meantime, is there any way I can reach my goal without Tsearch2
by just restructuring my query to narrow down the results by date
first, then seq scan for the 'likes'?

-Dan


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Query tuning help
Next
From: Russell Smith
Date:
Subject: Re: Query tuning help