Pounding CPU

I ran the cursor query as in your first example. I really suspect a configuration issue, most likely with msyql (especially since you mentioned it’s still very slow from the command line).

Is this a server you setup yourself?

I suspect a configuration issue as well. This is a server we installed in our server array. It is debian 5 running as a Proxmox open VZ virtual machine. It has 4 Gigs RAM and two processors assigned to it. Before my basic tuning (of mysql) it was a default install of apache, mysql, and php.

I have only used mysql for small applications and Wordpress, so this is the first time using it for a large application. Instead I normally use Oracle or Sybase, which on the same server array does not suffer these problems. Basically not an expert on configuring MySQL/PHP for good performance :(.

Wish I could help more but it’s not my area of expertise at all…you might try the server management forum, and for clarity take the php out of the mix and focus on how long the query is taking from the command line. Good luck!