Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Savely Reducing the q2a Database Size (when not using q2a's search)

+1 vote
asked Oct 30, 2013 in Q2A Core by q2apro

I am still having issues with the database size. Having a daily backup running gives me huge files on my server.

1. Running on 1.5.4 mod I have 260 MB for qa_blobs ← this will be reduced to 0 after I upgrade and mirgrate all images from blob to harddrive ✓

2. I still see qa_contentwords getting bigger and bigger. Today I emptied it to save up to 200 MB. As far as my investigation goes this table is only used for the internal search. I changed the search to Google Custom search engine, so I don't need it anymore.

3. Also qa_words is not needed using the other search engine, as far as I know.

Instead of manually emptying both tables, I would like to prevent q2a writing to them.

** Note: I cannot truncate qa_words, instead I get the mysql error message:

#1701 - Cannot truncate a table referenced in a foreign key constraint (`db123`.`qa_contentwords`, CONSTRAINT `qa_contentwords_ibfk_2` FOREIGN KEY (`wordid`) REFERENCES `db123`.`qa_words` (`wordid`))


Me and others once tried to find out which tables are not needed, but without a clear solution.

@gidgreen: It would be nice if you implement an option that qa_contentwords and qa_words and other tables related to the q2a search can be "switched off".



PS: From q2a security section the tables not need (? really all) seem to be: qa_cache, qa_contentwords, qa_iplimits, qa_posttags, qa_sharedevents, qa_tagwords, qa_titlewords, qa_userevents, qa_userlimits, qa_words

Q2A version: 1.5.4

1 Answer

+2 votes
answered Oct 31, 2013 by gidgreen
selected Oct 31, 2013 by q2apro
Best answer

If you comment out this line in qa-base.php, the search-related tables will no longer be populated:

qa_register_module('search', 'qa-search-basic.php', 'qa_search_basic', '');

commented Oct 31, 2013 by q2apro
edited Oct 31, 2013 by q2apro
I guess I have to keep the search module activated but comment out in qa-search-basic.php: $contentwordidcounts=array(); ... ... ...

Maybe also commenting out: qa_db_word_contentcount_update(array_keys($contentwordidcounts));

I tried and it works. Could there be any other dependency problems?
Thanks, Kai
commented Nov 1, 2013 by q2apro
Good, I disabled the above and qa_contentwords is not filled anymore, and the related questions are working. Nice one!