What's quicker; including another file or querying a MySQL database in PHP?

后端 未结 12 1702
闹比i
闹比i 2021-01-12 04:29

In PHP, which is quicker; using include(\'somefile.php\') or querying a MySQL database with a simple SELECT query to get the same information?

12条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-12 05:11

    If this is something you're going to be fetching on a regular basis it might be worthwhile to prefetch the data (from disk or the database, doesn't matter) and have your script pull it from a RAM cache like memcached.

提交回复
热议问题