By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,067 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

About TSearch2 Performance

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.