Re: Optimizing table (shall I create a primary field?)

2008-04-30 Thread Sebastian Mendel
Charles Lambach schrieb: Hi. My hosting provider recommended me to optimize my 200,000 record table in order to save resources. I do _always_ this query: SELECT * FROM books WHERE isbn='foo' LIMIT 1 The primary key of this table was 'id', and 'isbn' was and INDEX field. I've modified this:

Re: Optimizing table (shall I create a primary field?)

2008-04-29 Thread Charles Lambach
Thank you all for your suggestions. So it's very important to make primary fields be as smaller as possible, right? I'm going to change 'isbn' from VARCHAR(100) to VARCHAR(25) and, if possible (I might change my code), from VARCHAR to BIGINT. By the way, which are optimal values for key_len

Re: Optimizing table (shall I create a primary field?)

2008-04-29 Thread Rob Wultsch
On Tue, Apr 29, 2008 at 5:09 AM, Charles Lambach [EMAIL PROTECTED] wrote: Thank you all for your suggestions. So it's very important to make primary fields be as smaller as possible, right? I'm going to change 'isbn' from VARCHAR(100) to VARCHAR(25) and, if possible (I might change my

Re: Optimizing table (shall I create a primary field?)

2008-04-28 Thread Charles Lambach
Hi Rob. Thank you very much for your answer. CREATE TABLE `books` ( `id` int(11) unsigned NOT NULL auto_increment, `title` varchar(200) NOT NULL, `author_name` varchar(100) NOT NULL, `category_name` varchar(100) NOT NULL, `description` varchar(200) NOT NULL, `isbn` varchar(100) NOT

Re: Optimizing table (shall I create a primary field?)

2008-04-28 Thread Rob Wultsch
I am going to assume that you are asking this question because performance has not improved from this change. Is this correct? I don't think that your surogate key (id) is useful, but that is probably minor. I think that your hostings company suggestion is probably a good idea, but will also

Re: Optimizing table (shall I create a primary field?)

2008-04-28 Thread Rob Wultsch
On Mon, Apr 28, 2008 at 6:49 AM, Rob Wultsch [EMAIL PROTECTED] wrote: I am going to assume that you are asking this question because performance has not improved from this change. Is this correct? I don't think that your surogate key (id) is useful, but that is probably minor. I think that

Re: Optimizing table (shall I create a primary field?)

2008-04-28 Thread Wm Mussatto
On Mon, April 28, 2008 09:44, Rob Wultsch wrote: On Mon, Apr 28, 2008 at 6:49 AM, Rob Wultsch [EMAIL PROTECTED] wrote: I am going to assume that you are asking this question because performance has not improved from this change. Is this correct? I don't think that your surogate key (id) is

Optimizing table (shall I create a primary field?)

2008-04-27 Thread Charles Lambach
Hi. My hosting provider recommended me to optimize my 200,000 record table in order to save resources. I do _always_ this query: SELECT * FROM books WHERE isbn='foo' LIMIT 1 The primary key of this table was 'id', and 'isbn' was and INDEX field. I've modified this: ALTER TABLE books DROP

Re: Optimizing table (shall I create a primary field?)

2008-04-27 Thread Rob Wultsch
On Sun, Apr 27, 2008 at 3:59 AM, Charles Lambach [EMAIL PROTECTED] wrote: I do _always_ this query: SELECT * FROM books WHERE isbn='foo' LIMIT 1 The primary key of this table was 'id', and 'isbn' was and INDEX field. This sentence could have been better written. If you have a primary key