Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UPa6u-0004Ct-Bu for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Apr 2013 15:05:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UPa6t-0005RT-Rh for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Apr 2013 15:05:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UPV9D-0002yd-AR for pgsql-bugs@postgresql.org; Tue, 09 Apr 2013 09:47:27 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UPV99-0000EW-Qe for pgsql-bugs@postgresql.org; Tue, 09 Apr 2013 09:47:26 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UPV98-0006F3-Rg for pgsql-bugs@postgresql.org; Tue, 09 Apr 2013 09:47:23 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1UPV93-0002Dp-Lc for pgsql-bugs@postgresql.org; Tue, 09 Apr 2013 09:47:17 +0000 Date: Tue, 09 Apr 2013 09:47:17 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #8048: Text Search To: pgsql-bugs@postgresql.org From: luigisag@gmail.com X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 8048 Logged by: Luigi Email address: luigisag@gmail.com PostgreSQL version: 9.2.0 Operating system: Windows 7 Description:=20=20=20=20=20=20=20=20 I've configured 2 table like this CREATE TABLE "User_Full_Text_Search" ( "Email" varchar(50), "UserId" varchar(50), "Full_Text_Search" varchar(4096) ) WITH (OIDS=3DFALSE) ; =20=20=20=20=20=20=20=20 ALTER TABLE "User_Full_Text_Search" OWNER TO "postgres"; =20=20=20=20=20=20=20=20 CREATE INDEX IX_FullText ON "User_Full_Text_Search" USING gin(to_tsvector('italian', "Full_Text_Search")); =20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20 CREATE TABLE "User_Full_Text_Search_2" ( "Email" varchar(50), "UserId" varchar(50), "Full_Text_Search" varchar(4096), "tsv" varchar(4096) ) WITH (OIDS=3DFALSE) ; =20=20=20=20=20=20=20=20 ALTER TABLE "User_Full_Text_Search_2" OWNER TO "postgres"; =20=20=20=20=20=20=20=20 CREATE INDEX IX_FullText_2 ON "User_Full_Text_Search_2" USING gin("tsv"); CREATE TRIGGER "tsvectorupdate" BEFORE INSERT OR UPDATE ON "User_Full_Text_Search_2" FOR EACH ROW EXECUTE PROCEDURE "tsvector_update_trigger"('tsv', 'pg_catalog.italian', 'Full_Text_Search'); Column Full_Text_Search (table User_Full_Text_Search) is just a single word or max 2 words separeted by space " " (ex: test tester), and tsv (table User_Full_Text_Search_2) is populate by materializing column with a ts_vector of Full_Text_Search. Now if i perform those 2 queries select "UserId","Email" from "User_Full_Text_Search"=20=20=20=20 where to_tsvector('italian',"Full_Text_Search") @@ to_tsquery('italian', 'test|developer') GROUP BY "UserId","Email" =20=20=20=20 select "UserId","Email" from "User_Full_Text_Search_2"=20=20=20=20 where "tsv" @@ to_tsquery('italian', 'test|developer') GROUP BY "UserId","Email" Records on Tables (are same) like 10 milion.=20 Execution time of 1st query is 120 seconds (result set like 750.000) Execution time of 2st query is 270 seconds (result set like 750.000) same records I don't understand why a materialized column is more slow than a calculeted one... --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs