X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B5C7C533EE for ; Sun, 8 May 2005 23:31:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57622-05 for ; Mon, 9 May 2005 02:31:40 +0000 (GMT) Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by svr1.postgresql.org (Postfix) with ESMTP id B464552AA9 for ; Sun, 8 May 2005 23:31:36 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id 324C36441C8 for ; Sun, 8 May 2005 20:31:34 -0600 (MDT) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26232-05 for ; Sun, 8 May 2005 20:31:33 -0600 (MDT) Received: from [192.168.1.3] (c-24-9-111-5.hsd1.co.comcast.net [24.9.111.5]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by crestone.coronasolutions.com (Postfix) with ESMTP id 533C96441B9 for ; Sun, 8 May 2005 20:31:33 -0600 (MDT) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <200505081906.47731.josh@agliodbs.com> References: <924ac6c029f5453c442eacdda06b132c@drivefaster.net> <200505091051.14689.mr-russ@pws.com.au> <6f4a543a2fbd348c7e82876b8e477600@drivefaster.net> <200505081906.47731.josh@agliodbs.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <7fc67646a961f5ebef90def7aeb95fd0@drivefaster.net> Content-Transfer-Encoding: 7bit From: Dan Harris Subject: Re: Query tuning help Date: Sun, 8 May 2005 20:31:38 -0600 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200505/95 X-Sequence-Number: 12259 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