Innodb – Safe values for InnoDB variables when using FULLTEXT searches

full-text-searchinnodbmariadb

I'm using Maria DB, version 10.2.22, where one database column uses FULLTEXT for a broad document searching. However, I've ran into a "Table handler out of memory" on some searches. The table itself is only 4.4 GB. I've read on stackoverflow, that changing some of the InnoDB variables such as:

• innodb_buffer_pool_size

• innodb_ft_result_cache_limit

from their default value to say 4 GB could potential solve to the memory issue. My question is three parts, I suppose.

  1. Are there any other variables I should consider changing.

• innodb_buffer_pool_instances
• innodb_ft_cache_size
• innodb_ft_total_cache_size

  1. Because this DB is fairly critical to run, after running the command lines to change the variables would I need to stop and start the MariaDB service to fetch these changes?

  2. If, restarting MariaDB services is needed, can anyone point me to a guide as far as how to safely change these variables?

Best Answer

  • innodb_buffer_pool_size -- This should be set to about 70% of RAM. But, if the other settings encroach too much into this, then lower it. Swapping is bad.
  • innodb_buffer_pool_instances -- Simply set it to innodb_buffer_pool_size / 1G -- rounded down, but at least 1
  • innodb_ft_cache_size -- big enough for at least one row of text being indexed via FULLTEXT. Bigger if practical, but don't squeeze out the buffer_pool
  • innodb_ft_total_cache_size -- If you are [re]building FULLTEXT in only one thread at a time, this is not relevant.
  • innodb_ft_result_cache_limit -- This is relevant only to SELECTs that involve a FULLTEXT index. The max is 4G, but don't set it that large unless you have lots of RAM. Start with, say, 1% of RAM; if you get an error, then raise it.

The settings are not dynamic, so change the config file and restart mysqld.

How much RAM do you have? What is a typical and the max size of the column(s) in the fulltext index?