Page 1 of 1

How to analyze mySQL performance in PHP pages (memory proble

Posted: Wed Apr 04, 2007 3:35 am
by guarriman
Hi.

Working with PHP 4.4.2 and MySQL 4.1.19, I'm suffering some memory problems on my server (memory allocations, slowness), and would like to know if my mySQL queries are well-designed in terms of memory.

My website allow users to register and to share items with several degrees of privacity, so each time someone accesses webpages I must check which items are public or not, by using SQL queries. I've written code by myself so I may've done some mistakes.

Is there any way to check this mySQL performance? Some tips?

Thank you very much.

Posted: Wed Apr 04, 2007 3:41 am
by Benjamin
Be sure the fields in WHERE and JOIN clauses are indexed. That should help quite a bit in most situations.

Posted: Wed Apr 04, 2007 7:14 am
by feyd
Use EXPLAIN queries to figure out which fields need indexing. If you make a lot of indexes you'll produce even slower results.

Posted: Wed Apr 04, 2007 11:39 am
by Oren
feyd wrote:indexes
That was on purpose?

Posted: Wed Apr 04, 2007 12:21 pm
by feyd
huh?

Posted: Wed Apr 04, 2007 1:25 pm
by Oren
I thought the plural of 'index' was: 'indices'? :?

Posted: Wed Apr 04, 2007 1:30 pm
by feyd
It's both, actually.