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 )
6
  • Perhaps you could share the query? Jul 19, 2021 at 10:36
  • One "optimize table" does 2000 words, the next the following 2000, ... 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) Jul 19, 2021 at 11:49
  • MySQL version of both machines?
    – Rick James
    Aug 26, 2021 at 19:22
  • And please provide SHOW CREATE TABLE SEARCHTABLE.
    – Rick James
    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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.