472,102 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

About TSearch2 Performance

Hi,

Is there any performance diference between the following SQL commands:

SELECT * FROM documents WHERE content_ix @@ to_tsquery('word1&word2|word3');

SELECT * FROM documents WHERE content_ix @@ to_tsquery('word1') AND
content_ix @@ to_tsquery('word2') OR content_ix @@ to_tsquery('word3');

I'm having to do this on some complex querys to put LIKEs between some
ts_querys.
Does anyone has such experience?

Thanks in advance,

--
Diogo Biazus
di***@ikono.com.br
http://www.ikono.com.br

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #1
3 1996
First one will be a bit faster

Diogo Biazus wrote:
Hi,

Is there any performance diference between the following SQL commands:

SELECT * FROM documents WHERE content_ix @@
to_tsquery('word1&word2|word3');

SELECT * FROM documents WHERE content_ix @@ to_tsquery('word1') AND
content_ix @@ to_tsquery('word2') OR content_ix @@ to_tsquery('word3');

I'm having to do this on some complex querys to put LIKEs between some
ts_querys.
Does anyone has such experience?

Thanks in advance,


--
Teodor Sigaev E-mail: te****@sigaev.ru
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #2
Teodor Sigaev wrote:
First one will be a bit faster

Diogo Biazus wrote:
Hi,

Is there any performance diference between the following SQL commands:

SELECT * FROM documents WHERE content_ix @@
to_tsquery('word1&word2|word3');

SELECT * FROM documents WHERE content_ix @@ to_tsquery('word1') AND
content_ix @@ to_tsquery('word2') OR content_ix @@ to_tsquery('word3');

I'm having to do this on some complex querys to put LIKEs between
some ts_querys.
Does anyone has such experience?

Thanks in advance,

What do those @@ do for the statement?

--
"You are behaving like a man",
is an insult from some women,
a compliment from an good woman.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #3
On Friday 24 October 2003 08:18, Dennis Gearon wrote:
Teodor Sigaev wrote:
First one will be a bit faster

Diogo Biazus wrote:
Hi,

Is there any performance diference between the following SQL commands:

SELECT * FROM documents WHERE content_ix @@
to_tsquery('word1&word2|word3');

SELECT * FROM documents WHERE content_ix @@ to_tsquery('word1') AND
content_ix @@ to_tsquery('word2') OR content_ix @@ to_tsquery('word3');

I'm having to do this on some complex querys to put LIKEs between
some ts_querys.
Does anyone has such experience?

Thanks in advance,


What do those @@ do for the statement?


That is an operator defined when tsearch2 is installed. It does comparison on
the types from tsearch2 (tsvector, tsquery).

Andy

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

25 posts views Thread by Brian Patterson | last post: by
reply views Thread by Clay Luther | last post: by
1 post views Thread by 帅猛 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.