dqf67993 2010-02-09 05:23
浏览 20
已采纳

一些问题,MySql缓存问题

First of all, I am using PhpMyAdmin, is this okay or not? Because when I have cache disabled, and do two queries after eachother, the second query always is faster, so I am thinking maybe there is an internal cache on PhpMyAdmin?

Secondly, is there any way to get the time of how long a query takes, into php, and echo it onto the browser? (so I can use php instead of phpMyAdmin)

Thirdly, SHOW STATUS LIKE '%qcache%' gives me this:

Qcache_free_blocks       1
Qcache_free_memory       25154096
Qcache_hits              0
Qcache_inserts       2
Qcache_lowmem_prunes     0
Qcache_not_cached        62
Qcache_queries_in_cache  2
Qcache_total_blocks      6

How come Qcache_not_cached grows by a number of 5 or 10 for every query I make? Shouldn't there only be 1 increase per query?

Also, when I enabled the cache, and did a query, the Qcache_queries_in_cache got increased by 2... I thought it would be increased by 1 per every query, explain someone?

THEN, when I did another query the same as the one I cached, there was no performance gain at all, the query took as long as without the cache enabled...

Any help here please except for referring to the manual (I have read it already).

Thanks

UPDATE

Here is a typical query I make:

   SELECT * FROM `langlinks` WHERE ll_title='Africa'
  • 写回答

2条回答 默认 最新

  • douzhan5262 2010-02-09 05:45
    关注

    First of all, I am using PhpMyAdmin, is this okay or not?

    I suppose it's better than nothing -- and more user-friendly than a command-line client ; but a thing I don't like with phpMyAdmin is that it sends queries you didn't write.

    I've already seen phpMyAdmin send some queries that were "hurting" a server, while the one that had been written by the user was OK, for instance (I don't have the exact example in mind).

    Generally speaking, though, I'd say it's "ok" as long as you accept that more requests will be sent : phpMyAdmin displays lots of informations (like the list of databases, tables, and so on), and has to get those informations from somewehre !

    Shouldn't there only be 1 increase per query?

    If you really want to see the impact of your query and no other, you'd probably better use the command-line mysql client, instead of phpMyAdmin : that graphical tool has to send queries to get the informations it displays.

    The question, actually, is : do you prefer a user-friendly tool ? Or do you want to monitor only what your query actually does ?

    In most cases, the answer is "user-friendly tool" -- and that's why phpMyAdmin has so much success ;-)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab