# Dynamic searchable fields, best practice?

**URL:** <https://www.ruby-forum.com/t/dynamic-searchable-fields-best-practice/188460>\
**Category:** Rails\
**Created:** [May 12, 2010, 11:10am UTC](https://www.ruby-forum.com/t/dynamic-searchable-fields-best-practice/188460 "2010-05-12T11:10:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![boblu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b19c9b/32.png) [@boblu](https://www.ruby-forum.com/u/boblu)\
**Post date:** [May 12, 2010, 11:10am UTC](https://www.ruby-forum.com/t/dynamic-searchable-fields-best-practice/188460/1 "2010-05-12T11:10:15Z")

</div>

I have a Lexicon model, and I want user to be able to create dynamic  
feature to every lexicon.

And I have a complicate search interface that let user search on every  
single feature (including the dynamic ones) belonged to Lexicon model.

I could have used a serialized text field to save all the dynamic  
information if they are not for searching.

In case I want to let user search on all fields, I have created a  
DynamicField Model to hold all dynamically created features.

But imagine I have 1,000,000,000 lexicon, and if one create a dynamic  
feature for every lexicon, this will result creating 1,000,000,000  
rows in DynamicField model.

So the sql search function will become quite inefficient while a lot  
of dynamic features created.

Is there a better solution for this situation?

Which way should I take?

searching for a better db design for dynamic fields

try to tuning mysql(add cache fields, add index …) with current db  
design
