How to know the maximum length of a field

2008-04-29 Thread Charles Lambach
Hi. I've got a table with some fields, which I created with VARCHAR(100). I want to optimize this table, and I want to modify the length of these fields from VARCHAR(100) to VARCHAR(maximum_length), where "maximum_length" is the length of the record with the longest field. I could create a Perl

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" par

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

2008-04-28 Thread Charles Lambach
type=const possible_keys=PRIMARY key=PRIMARY key_len=302 ref=const rows=1 Extra= -- Regards, --Charles On 4/27/08, Rob Wultsch <[EMAIL PROTECTED]> wrote: > > On Sun, Apr 27, 2008 at 3:59 AM, Charles Lambach > <[EMAIL PROTECTED]> wrote: > > I do _always_

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 PRIMAR