Re: Dumb question involving to_tsvector and a view - Mailing list pgsql-general

From Kevin Grittner
Subject Re: Dumb question involving to_tsvector and a view
Date
Msg-id 1361566662.40220.YahooMailNeo@web162904.mail.bf1.yahoo.com
Whole thread Raw
In response to Dumb question involving to_tsvector and a view  ("Raymond C. Rodgers" <sinful622@gmail.com>)
Responses Re: Dumb question involving to_tsvector and a view  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Raymond C. Rodgers <sinful622@gmail.com> wrote:=0A=0A> As I went to add a t=
svector column, it occurred to me that it=0A> might be possible to add a dy=
namic tsvector column through the=0A> use of a view, so I created a tempora=
ry view with a command along=0A> the lines of:=0A>=0A>=A0=A0=A0=A0 CREATE T=
EMPORARY VIEW ftstest AS SELECT id, field1, field2,=0A> TO_TSVECTOR(COALESC=
E(field1,'') || ' ' ||=0A> COALESCE(field2,'')) AS txtsrch FROM mytable;=0A=
>=0A> To my surprise, it worked. Now, I'm sitting here thinking about=0A> t=
he performance impact that doing this would have.=0A=0AI had a similar situ=
ation and benchmarked it both ways.=A0 For my=0Asituation I came out ahead =
writing the extra column for inserts and=0Aupdates than generating the tsve=
ctor values on the fly each time it=0Awas queried.=A0 YMMV.=A0 It probably =
depends mostly on the ratio of=0Ainserts and updates to selects.=0A=0A--=0A=
Kevin Grittner=0AEnterpriseDB: http://www.enterprisedb.com=0AThe Enterprise=
 PostgreSQL Company

pgsql-general by date:

Previous
From: Leonardo M. Ramé
Date:
Subject: Spellcheck function
Next
From: Alejandro Carrillo
Date:
Subject: ...