Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a set of ~4700 records that I need to have locally searchable for my plugin via an auto-complete (it's the Google Product Search categories). Would it be okay to store this data in the options table as an array or would it be better to actually create a separate table in which to store this data?

It's about 317k. Would I be asking for trouble if I just stored it as an array in the options table? Does each page load cache all the site options?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Each page load triggers a database query that reads all the options (from what I'm aware the option records are all auto-loaded).

Anyway 317 K is not something you should worry about, but there are better ways to store your data, for example a simple text file that gets read trough ajax only when the search is being made (first character typed I guess).

You can cache the data after the first load if you want, using wp_cache_set() (and delete it when you're updating the list). You need some persistent object cache plugin to keep it across page requests.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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