Question

I want to create a query result page for a simple search, and i don't know , should i use views in my db, would it be better if i would write a query into my code with the same syntax like i would create my view.

What is the better solution for merging 7 tables, when i want to build a search module for my site witch has lots of users and pageloads? (I'm searching in more tables at the same time)

Was it helpful?

Solution

If you always use all 7 tables, i think you should use views. Be aware that mysql changes your original query when creating the view so its always good practice to save your query elsewhere.

Also, remember you can tweak mysql's query cache env var so that it stores more data, therefore making your queries respond faster. However, I would suggest that you used some other method for caching like memcached. The paying version of mysql supports memcached natively, but Im sure you can implement it in the application layer no problem.

Good luck!

OTHER TIPS

you would be better off using a plain query with joins, instead of a view. VIEWS in MySQL are not optimized. be sure to have your tables properly indexed on the fields being used in the joins

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top