Re: MySQl 5.0 optimization problem

2008-04-11 Thread Victor Danilchenko
First of all, my bad -- I forgot to mention that I use MyISAM. mysql> show table status from example like 'leads'\G *** 1. row *** Name: leads Engine: MyISAM Version: 10 Row_format: Dynamic Rows: 1

Re: MySQl 5.0 optimization problem

2008-04-11 Thread Rob Wultsch
On Fri, Apr 11, 2008 at 6:47 AM, Ben Clewett <[EMAIL PROTECTED]> wrote: > A COUNT() forces the system to read every row in order to count them... That is not strictly the case. A count(field) can use an index scan rather than a sequential scan, which may or may not be faster. Also some count(field)

Re: MySQl 5.0 optimization problem

2008-04-11 Thread Ben Clewett
Hi, Can you please post your query? I also need to know your table type as different settings effect different table types? You are right that a SELECT COUNT(*) WHERE field = 'value' should hit the index, but does depend on your query. You might also try EXPLAIN before your query, which wi

Re: MySQl 5.0 optimization problem

2008-04-11 Thread Wm Mussatto
On Fri, April 11, 2008 06:47, Ben Clewett wrote: > Are you using MyIsam or InnoDB? Or something else? > > In either case the speed to get a COUNT() is largely down to the speed > if your disks and size of disk caching. A COUNT() forces the system to > read every row in order to count them, and an

Re: MySQl 5.0 optimization problem

2008-04-11 Thread Ben Clewett
Are you using MyIsam or InnoDB? Or something else? In either case the speed to get a COUNT() is largely down to the speed if your disks and size of disk caching. A COUNT() forces the system to read every row in order to count them, and any large table is probably larger than your caches. I

MySQl 5.0 optimization problem

2008-04-11 Thread Victor Danilchenko
Hi, I am trying to optimize our DB server. We have one table which has 1.3M entries, and the keys are GUIDs (so the key space is large). However, I have it all indexed. The performance was iffy, though, so I increased memory allocation, and the searches on the indexed fields seem to b