Search code examples
sphinxsphinxql

Sphinx purge deleted data


What is the best way to purge all old data from the Sphinx indexes? Right now, I issue an OPTIMIZE INDEX command, however this is only adding the job to the queue. Therefore, I thought if I measure the index size before the optimize command, I could wait in a while loop until the index is reduced in size?

Though, this doesn't seem to be the best solution. I have also tried FLUSH RAMCHUNK however this is affecting the RAM-chunks which isn't the solution I'm looking for. I want to purge not only the RAM-saved indexes, but the entire index.

What is best practice in this case?


Solution

  • In Manticore Search you can use OPTION sync=1 for OPTIMIZE to make it wait until the job is actually done. The documentation is https://docs.manticoresearch.com/latest/html/sphinxql_reference/optimize_index_syntax.html