From: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Gregory Stark <stark(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Why is there a tsquery data type? |
Date: | 2007-08-30 17:03:00 |
Message-ID: | Pine.LNX.4.64.0708302102080.2767@sn.sai.msu.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 30 Aug 2007, Bruce Momjian wrote:
> Gregory Stark wrote:
>> "Bruce Momjian" <bruce(at)momjian(dot)us> writes:
>>
>>> There is no question things would be clearer with only one text search
>>> data type. The only value I can see to having a tsquery data type is
>>> that you can store a tsquery value in a column, but why would that be
>>> much better than just storing it in a TEXT field?
>>
>> When you try storing a tsquery in a column does it alert you if you have an
>> invalid syntax at that point? Storing it as text would mean not finding out
>> until you try to use the query.
>
> Yes it does check syntax:
>
> test=> select 'lkjadsf kjfdsa'::tsquery;
> ERROR: syntax error in tsearch query: "lkjadsf kjfdsa"
>
> A larger question is how many people store queries in the database to
> make it worth the complexity.
you forget about very powerfull query rewriting, which is table driven
>
>> Is converting a text query into the internal format faster or less memory
>> intensive than converting text into the internal representation? When you run
>> a query like "WHERE '...' @@ col" if there wasn't a tsquery data type then
>> '...' would have to be parsed over and over again for each row.
>
> No, internally the TEXT string would be converted to something the
> system could deal with for that query, which is probably what 99% of all
> queries are going to do anyway by calling to_tsquery().
>
>
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru)
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2007-08-30 17:04:29 | Re: tsearch2, gin and @@@ operator? |
Previous Message | Alvaro Herrera | 2007-08-30 16:41:51 | Re: reindexdb hangs |