pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: luigisag@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #8048: Text Search
Date: Tue, 09 Apr 2013 09:47:17 +0000
Message-ID: <E1UPV93-0002Dp-Lc@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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:        

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=FALSE)
        ;
        
        ALTER TABLE "User_Full_Text_Search" OWNER TO "postgres";
        
        CREATE INDEX IX_FullText ON "User_Full_Text_Search" USING
gin(to_tsvector('italian', "Full_Text_Search"));
        
        
        CREATE TABLE "User_Full_Text_Search_2" (
        "Email" varchar(50),
        "UserId" varchar(50),
        "Full_Text_Search" varchar(4096),
        "tsv" varchar(4096)
        )
        WITH (OIDS=FALSE)
        ;
        
        ALTER TABLE "User_Full_Text_Search_2" OWNER TO "postgres";
        
        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"    
    where to_tsvector('italian',"Full_Text_Search") @@ to_tsquery('italian',
'test|developer')
    GROUP BY "UserId","Email"
    
    select "UserId","Email" from "User_Full_Text_Search_2"    
    where "tsv" @@ to_tsquery('italian', 'test|developer')
    GROUP BY "UserId","Email"

Records on Tables (are same) like 10 milion. 

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...



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <E1UPV93-0002Dp-Lc@wrigleys.postgresql.org>
Permalink:  ../E1UPV93-0002Dp-Lc@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1UPV93-0002Dp-Lc@wrigleys.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: luigisag@gmail.com
  Subject: Re: BUG #8048: Text Search
  In-Reply-To: <E1UPV93-0002Dp-Lc@wrigleys.postgresql.org>
  References: <E1UPV93-0002Dp-Lc@wrigleys.postgresql.org>

* 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