php - SQL 查询在 MYSQL 中花费更少的时间,在 PHP 应用程序中花费更多时间

标签 php mysql database-performance query-performance

我有 MYISAM 表,我写了一个 FULL-TEXT SQL 查询。 当我执行此查询时,需要 < 0.53 秒 但是当我执行这个php+mysql应用程序时,需要1-2分钟以上

查询:

select concat(first_name, ' ', last_name) as `cand_full_name`, email 
from resumes WHERE MATCH (thesis_text) AGAINST ('-java -j2ee -oracle -mysql -software' IN BOOLEAN MODE) 

更新 1:

我在查询中使用 mysqli_query($this->dbconnection, $this->query)

更新 2:

PHP 代码 http://codepad.org/qufZBC16

注意事项:

我没有在此页面上运行任何其他 sql 查询。

任何想法,为什么要花更多时间。

最佳答案

很可能是字符集问题。连接后设置charset,加快查询速度

http://php.net/manual/en/mysqli.set-charset.php#refsect1-mysqli.set-charset-description

我不确定你的数据存储在什么字符集中

关于php - SQL 查询在 MYSQL 中花费更少的时间,在 PHP 应用程序中花费更多时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27114758/

相关文章:

PHP PDO post 字符串列表 INWhere 子句

database-performance - SQL Server : Why is SELECT on case insensitive column faster than on case sensitive?

php - 开发像 Stackoverflow 一样的聊天 API

php - 在 PHP 中运行此代码时出现错误

php - 如何使用 PHP 使用两个键查找单个值?

php - 如何复制MySQL字段?

mysql - 错误 1064 (42000) : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version

javascript - 不允许使用 Codeigniter/PHP(405 错误)在 jQuery Blueimp FileUpload 上删除方法?

mysql - 处理大量数据的批量插入

mysql - 数据库速度优化(多次查询)