Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 8D4069FC420 for ; Fri, 23 Feb 2007 19:09:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 00467-02 for ; Fri, 23 Feb 2007 19:09:40 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.236]) by postgresql.org (Postfix) with ESMTP id 89BBB9FC38C for ; Fri, 23 Feb 2007 19:09:44 -0400 (AST) Received: by wr-out-0506.google.com with SMTP id i7so777224wra for ; Fri, 23 Feb 2007 15:09:43 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qXgVHzaHJua22Tyf0XMoK3V6qY1Kq2e4FTfdv6HJ5IReZy+/7tFfxHVFsDseRf2nFxvdlFEsU4wPvB9qsBAHYxmff5GlPYyCQAY8BoERV6INSL8f5IWJ4Embkd78+zVrgeDHYKRaxR4wtnWpuSkuuvjtlw5xp62/ZoDCMoSZdXQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OFvixrIz4fxXVp2a5fOtbJimHIJcTT47X0X/RwP6fV0nksO0IGidaJzL4+H6zEvXMBQ3hX/HuFrCm1oUiavR6XNvaDD6jLTlU8i1DV2FGrq0lrmof+QA2k8rjDZoU7dFjZD2ErHNyjclZ2/T2CsS6+04hVPoY06Hh57De4KrsV8= Received: by 10.90.25.3 with SMTP id 3mr2771960agy.1172272181708; Fri, 23 Feb 2007 15:09:41 -0800 (PST) Received: by 10.90.113.7 with HTTP; Fri, 23 Feb 2007 15:09:41 -0800 (PST) Message-ID: <1d4e0c10702231509k7ad24e2ck3a149a2e3a2899f7@mail.gmail.com> Date: Sat, 24 Feb 2007 00:09:41 +0100 From: "Guillaume Smet" To: "Florian Weimer" , "Steinar H. Gunderson" Subject: Re: pg_trgm performance Cc: pgsql-performance@postgresql.org In-Reply-To: <20070115125834.GA28248@uio.no> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <82mz4k4mt7.fsf@mid.bfk.de> <20070115125834.GA28248@uio.no> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/267 X-Sequence-Number: 23321 Florian, Steinar, Could you try to see if the GIN implementation of pg_trgm is faster in your cases? Florian, instead of using WHERE similarity(...) > 0.4, you should use set_limit (SELECT set_limit(0.4);). I posted it on -patches and it is available here: http://people.openwide.fr/~gsmet/postgresql/pg_trgm_gin3.diff . The patch is against HEAD but It applies on 8.2 without any problem. After applying this patch and installing pg_trgm.sql (you should uninstall pg_trgm before compiling using the old uninstall script), then you can create: CREATE INDEX idx_table_word ON table USING gin(word gin_trgm_ops); 17 characters is quite long so I'm not sure it will help you because it usually has to recheck a high number of rows due to the GIN implementation but I'd like to know if it's faster or slower in this case. If your data are not private and you don't have the time to test it, I can test it here without any problem. Thanks. -- Guillaume