8

I am trying to dump sql from local dev site to production server, I found that search_index & search_dataset these two tables are big, made the sql file really big.

I am guessing these two tables are about storing search indexes which I can always to re-index from scratch later. Correct me if wrong.

So is it OK/safe to delete all the records of them? then export the database, import to my server. By doing this I can reduce the file size of dump file.

Thanks!

1
  • Just a quick note: You don't have to delete all the records and then export. If you use drush... do something like drush sql-dump --structure-tables-list=search_index,cache,cache_form Oct 14, 2015 at 19:52

1 Answer 1

10

These tables are used by the site's search function, as provided by the core's Search module. They're built from your site's content, and the descriptions in code in search_schema() say:

  • search_dataset - "Stores items that will be searched"
  • search_index - "Stores the search index, associating words, items and scores"

Though you can ignore/truncate the contents of these tables to keep your database dumps smaller, they will be recreated during cron runs as your site's content is re-indexed. Beware that rebuild times can be a lengthy if your site has a lot of content.

I've always found the Backup and Migrate module to be much handier than command-line MySQL as tables and/or their contents can be ignored, plus do scheduled dumps and have various export/import profiles.

Your Answer

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

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