In PHP, which is quicker; using include(\'somefile.php\')
or querying a MySQL database with a simple SELECT
query to get the same information?
Reading in raw data to a script from a file will generally be faster than from a database.
However it sounds like you are wanting to query that data in order to find a match to return to the javascript. You may find in that case that MySQL will be faster for the actual querying/searching of the data (especially if correctly indexed etc.) as this is something a database is good at.
Reading in a big file is also less scalable as you will be using lots of server memory while the script executes.