douyanguo7964 2018-02-06 14:20
浏览 31
已采纳

特殊的MySQL查询优化是否适用于PHP?

I'm trying to optimize a query used in a PHP script, and I've been trying to figure out if PHP accepts index hints in SQL statements, but I haven't been able to find documentation on it anywhere.

This is what the format of the query is:

Select a.columnName, b.columnName from tableName as a FORCE
INDEX(indexName) Inner Join tableName as b 
On a.columnName = b.columnName
Where a.columnName =..

Please forgive omitting the actual query, as I'm more concerned with trying to figure out if PHP allows queries like this rather than the data itself. I had to add the forced index to my query to make the query perform faster as the initial table it pulls from is rather large. Can anyone help me with figuring this out or point in the direction of some documentation on it?

For those wondering, I've already looked at the documentation on the MySQL pages, so I'm not really sure what else to look at.

  • 写回答

1条回答 默认 最新

  • duanchu9914 2018-02-06 14:35
    关注

    This will work, since PHP is just forwarding the SQL query direcly to the DBMS. So what works on the DBMS (e.g. MySql) will work with PHP.

    e.g. with mysqli::query for MySQL

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探