user1544337
user1544337

Reputation:

FULLTEXT search on two fields faster than on one field

I have two fields in a table in my database with a FULLTEXT index: one with about 60 characters content on average, the other with about 400. I'm doing a FULLTEXT search on this table like this:

... MATCH (table.field1, table.field2) AGAINST ("some string") ...

This takes about 8 seconds.

... MATCH (table.field1) AGAINST ("some string") ...

This takes about 18 seconds.

... MATCH (table.field2) AGAINST ("some string") ...

This takes about 22 seconds.


What strikes me is that when I do a search on more fields, the query is faster! I checked several times again, but the times stay like this. How is this possible? Would it be a good idea to add dummy data to add another field to the search and make it even faster?

Upvotes: 0

Views: 189

Answers (1)

davey
davey

Reputation: 1791

You probably have one FULLTEXT index for both fields. That what makes the single field query slow, because it can't use that index.

Upvotes: 1

Related Questions