At 9:47 AM -0500 5/26/99, A. Brandic wrote:
>My view was that if you use a CHAR rather than a VARCHAR, execution of a
>query is faster. Is this true, and how much faster?
>I've done some test on a few tables with 15 coulms and 15000 rows (simple
>selects and Joins) and there was a difference. I guess on bigger DBs the
>difference will be greter? Am I right (or left:)).
I'm not really sure. But you should be able to keep your table from
turning into a varible length table by creating it like this:
create table Tab1 (
That way, you won't have any VARCHAR columns, and MySQL won't mess
with your definition. :-)
>On Wed, 26 May 1999, Paul DuBois wrote:
>> At 8:49 AM -0500 5/26/99, kai@stripped wrote:
>> >The output of a
>> > show columns from TABLE
>> >command has problems with CHAR and VARCHAR columns. The script in the next
>> >section produces the following output:
>> >Field Type Null Key Default Extra
>> >Code varchar(8) YES NULL
>> >Bank varchar(40) YES NULL
>> >Method char(2) YES NULL
>> >Name varchar(40) YES NULL
>> >Each VARCHAR column was created as a CHAR column, and the CHAR column was
>> >created as a VARCHAR column.
>> >Execute the following script:
>> >set +x
>> >mysql -u root <<EOF
>> >drop database if exists bug;
>> >create database bug;
>> >use bug;
>> >create table Tab1 (
>> > Code CHAR(8),
>> > Bank CHAR(40),
>> > Method VARCHAR(2),
>> > Name CHAR(40)
>> >show columns from Tab1;
>> > ???
>> MySQL silently changes CHAR(N) to VARCHAR(N) for N>=4 if you have any
>> columns since by including such columns in your table, the records become
>> variable-length anyway.
>> Paul DuBois, paul@stripped
>> Northern League Chronicles: http://www.snake.net/nl/
>> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
>> posting. To request this thread, e-mail mysql-thread3963@stripped
>> To unsubscribe, send a message to the address shown in the
>> List-Unsubscribe header of this message. If you cannot see it,
>> e-mail mysql-unsubscribe@stripped instead.
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/