0

I have two Windows MySQL 5.7 InnoDB databases. One is a production db, and the other is a test db that was created from an image of the prod db. Both have equal data loaded from an Oracle merge script. The issue I discovered is that a FULLTEXT BOOLEAN MODE query returns the wrong result for a single query on the prod db.

Consider these two address records: "1234 12TH ST" & "1234 12TH STREET"

If I execute my FULLTEXT query for 1234 12TH on the test db, both rows are returned, But with the same query on the prod db only the first row is returned.

I’ve run out of things to check between the prod and test db. What else can I check?

  • Compared my.ini
  • Compared variables
  • Compared FULLTEXT indexes
  • Checked stopwords
  • Checked word length (I have it set to 1)
  • ran set GLOBAL innodb_optimize_fulltext_only=ON;
  • ran OPTIMIZE TABLE

(from Comment)

SELECT searchtable.ADDRPART1
 FROM SEARCHTABLE
 WHERE SEARCHTABLE.ROLLTYPE IN ('REAL PROPERTY')
 AND MATCH (SEARCHTABLE.ADDRPART1,SEARCHTABLE.ADDRPART2,
 SEARCHTABLE.ADDRPART3, SEARCHTABLE.ADDRPART4,
 SEARCHTABLE.ADDRPART5,
 SEARCHTABLE.ADDRPART6,SEARCHTABLE.ADDRPART7)
 AGAINST (+'+;1234+12TH' IN BOOLEAN MODE )
Rick James
80.7k5 gold badges52 silver badges119 bronze badges
asked Jul 19, 2021 at 2:40
6
  • Perhaps you could share the query? Commented Jul 19, 2021 at 10:36
  • One "optimize table" does 2000 words, the next the following 2000, ... Commented Jul 19, 2021 at 10:55
  • Here's the sql. I don't see any issue with it because it works for test db. SELECT searchtable.ADDRPART1 FROM SEARCHTABLE WHERE SEARCHTABLE.ROLLTYPE IN ('REAL PROPERTY') AND MATCH (SEARCHTABLE.ADDRPART1,SEARCHTABLE.ADDRPART2,SEARCHTABLE.ADDRPART3, SEARCHTABLE.ADDRPART4,SEARCHTABLE.ADDRPART5,SEARCHTABLE.ADDRPART6,SEARCHTABLE.ADDRPART7) AGAINST (+'+;1234+12TH' IN BOOLEAN MODE) Commented Jul 19, 2021 at 11:49
  • MySQL version of both machines? Commented Aug 26, 2021 at 19:22
  • And please provide SHOW CREATE TABLE SEARCHTABLE. Commented Aug 26, 2021 at 19:24

1 Answer 1

1

It's working now. I have to give credit to Gerard for letting me know about the 2000 word limit. When I ran OPTIMIZE TABLE the first time a few days ago, the process completed in 9 seconds and the issue unresolved. When I ran OPTIMIZE TABLE a second time today, the process ran for nearly 2 minutes and when done both records were returned. Thank you!

The innodb_ft_num_word_optimize option defines the number of words that are optimized each time OPTIMIZE TABLE is run. The default setting is 2000, which means that 2000 words are optimized each time OPTIMIZE TABLE is run. Subsequent OPTIMIZE TABLE operations continue from where the preceding OPTIMIZE TABLE operation ended.

enter image description here

answered Jul 19, 2021 at 11:59
1
  • To give credit where credit's due: it was in the manual. ;-) Commented Jul 19, 2021 at 12:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.