Re: Major diff between changing a VARCHAR to 70 or 100?
In article <11ml7ctkk8g3399@corp.supernews.com>,
"Laphan" <info@SpamMeNot.co.uk> writes:
> I do try and keep my field sizes tight rather than every varchar being 255
> chars long, but I didn't know if 100 chars slows a query down or is bigger
> in size DB wise than 70 chars.
If you try to keep your field sizes tight, then you shouldn't use MySQL:
if you make one of your fields by accident somewhat too tight, MySQL
(at least before version 5) will silently destroy some of your data.
Try this:
CREATE TABLE t1 (
id SERIAL,
val VARCHAR(10) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;
INSERT INTO t1 (val) VALUES ('1234567890');
INSERT INTO t1 (val) VALUES ('12345');
ALTER TABLE t1 MODIFY val VARCHAR(5) NOT NULL;
SELECT * FROM t1;
|