I am building a site using Django, and this site uses blocks that are included for a specific page.
I am currently using a text box containing paths when a block is enabled. When the page is requested, Django retrieves all the blocks from the database and re.search on the TextField.
However, I was wondering if it would be better to use a separate database table for blocks / paths, whether each row contained one path and a link to the block in terms of overhead.
I am not completely familiar with Django, but if I understand the situation correctly, you should use a table.
In fact, this is exactly the type of use that is developed and optimized for database software.
Do not worry. It will be faster.
Performing the search yourself, you are trying to implement part of the database logic yourself. Fun, of course, but not so fast. :)
Here are some good links to creating a database:
http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html
http://en.wikipedia.org/wiki/Third_normal_form
Hope this helps. Good luck. :-)
A separate DB table is definitely the βrightβ way to do this, because mysql has to send all the data from your TEXT fields every time you query. As you add more lines and the TEXT fields become larger, you will begin to notice performance problems and, ultimately, server crashes. In addition, you can use VARCHAR and add a unique pointer to the path, making the search quick.