php mariadb 查询语法,从PHP调用的查询中的MySQL(MariaDB)执行超时
在10.1版中使用MariaDB,您有兩種限制查詢的方法.它可以根據(jù)時間或查詢的行總數(shù)來完成.
按行:
SELECT ... LIMIT ROWS EXAMINED rows_limit;
你可以使用關(guān)鍵字EXAMINED并設(shè)置像你提到的400000行(從MariaDB 10.0開始).
按時間:
If the max_statement_time variable is set, any query (excluding stored
procedures) taking longer than the value of max_statement_time
(specified in seconds) to execute will be aborted. This can be set
globally, by session, as well as per user and per query.
如果你想要一個特定的查詢,我想,你可以使用這個:
SET STATEMENT max_statement_time=1 FOR
SELECT field1 FROM table_name ORDER BY field1;
請記住,max_statement_time是以秒為單位設(shè)置的(與MySQL相反,為毫秒),因此您可以更改它,直到找到最適合您的情況(從MariaDB 10.1開始).
如果您需要更多信息,我建議您使用excellent post關(guān)于查詢超時.
希望這對你有所幫助.
總結(jié)
以上是生活随笔為你收集整理的php mariadb 查询语法,从PHP调用的查询中的MySQL(MariaDB)执行超时的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 无“胃”竞巅峰!LPL季后赛今日开打 首
- 下一篇: 不变资本和固定资本的区别 不变资本和固定