In PHP, which is quicker; using include('somefile.php') or querying a MySQL database with a simple SELECT query to get the same information?
For example, say you had a JavaScript autocomplete search field which needed 3,000 terms to match against. Is it quicker to read those terms in from another file using include or to read them from a MySQL database using a simple SELECT query?
Edit: This is assuming that the database and the file I want to include are on the same local machine as my code.
It depends. If your file is stored locally in your server and the database is installed in another machine, then the faster is to include the file.
Buuuuut, because it depends on your system it could be not true. I suggest to you to make a PHP test script and run it 100 times from the command line, and repeat the test through HTTP (using cURL)
Example:
use_include.php
use_myphp.php