☮ Vašek
2011-04-03 05:20:26 UTC
I'd like to write a live search script simplifying the input of some fields. For example, when one is about to insert a name of a student, I'd like the website to offer a list of suggestions in real time. That means a short HTTP request & response every time a key is pressed.
My question is whether it is OK to call a SQL query for each of this requests, or whether I should try and cache the results in a PHP variable somehow. The query would need to provide some extra information, so it would probably also include a left join and sorting in two columns. The size of the tables is about the number of people I mentioned above.
The web server is running on a PC, used also for other purposes, namely running demanding mathematics software packages, so I should watch the load my scripts demand.