duanchao1002 2013-01-09 18:39
浏览 51

mysql快速命令和内存不足错误加上如何使用EXPLAIN

I have two questions, I am new to PHP and MySQL

first i want to know how to run EXPLAIN in query and see its results, when i use

$SQL = mysql_query("EXPLAIN SELECT id,name FROM table_name")

and i use

print_r($SQL)

it only gives me the resource id number value. I want to know that how it explain my query

i need and working example that shows me how to see the explains or how to print explains result on page to read.

And second question is that,

My single PHP page has more than 25 queries and all queries from different tables, and in some queries i have used inner joins, home page is set to display informations from many tables, and some tables are not used as joins,

The problem on this page is its displays the error message that "MySQL client ran out of memory".

So this problem is because of too many sql queries or only that my queries are not optimized very well.

Any suggestions..?

Edit

sorry i was forgot to mention that, is quick a solution for mysql client ran out of memory. Than how i can use it in PHP/MySQL queries?

  • 写回答

1条回答 默认 最新

  • duanmu6231 2013-01-09 18:44
    关注

    For the Explain statement, try running it from a query window or the command line.

    As for the error you're having, it means that mysql does not have enough memory to store the entire query result. Here's some more information.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题