Re: Dumb question involving to_tsvector and a view
От | Kevin Grittner |
---|---|
Тема | Re: Dumb question involving to_tsvector and a view |
Дата | |
Msg-id | 1361566662.40220.YahooMailNeo@web162904.mail.bf1.yahoo.com обсуждение исходный текст |
Ответ на | Dumb question involving to_tsvector and a view ("Raymond C. Rodgers" <sinful622@gmail.com>) |
Ответы |
Re: Dumb question involving to_tsvector and a view
|
Список | 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 по дате отправления: