List:General Discussion« Previous MessageNext Message »
From:Jason Pyeron Date:September 4 2005 5:15am
Subject:switching from varchar to tinytext
View as plain text  
if I switch name to TINYTEXT and index 'name' to (name(255),ppathref), 
will it handle utf8? that is the prefix of 255 chars or 255 bytes?


CREATE TABLE paths (
   id int(11) NOT NULL auto_increment,
   typeref tinyint(4) NOT NULL default '1',
   name varchar(255) NOT NULL default '',
   ppathref int(11) default NULL,
   PRIMARY KEY  (id),
   UNIQUE KEY name (name,ppathref),
   KEY ppathref (ppathref),
   KEY typeref (typeref),
   CONSTRAINT paths_ibfk_1 FOREIGN KEY (ppathref) REFERENCES paths (id),
   CONSTRAINT paths_ibfk_2 FOREIGN KEY (typeref) REFERENCES pathtypes (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

from http://dev.mysql.com/doc/mysql/en/create-index.html

Prefixes can be up to 255 bytes long (or 1000 bytes for MyISAM and InnoDB 
tables as of MySQL 4.1.2). Note that prefix limits are measured in bytes, 
whereas the prefix length in CREATE INDEX statements is interpreted as 
number of characters. Take this into account when specifying a prefix 
length for a column that uses a multi-byte character set.



-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Partner & Sr. Manager             7 West 24th Street #100     -
- +1 (443) 921-0381                 Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This message is for the designated recipient only and may contain 
privileged, proprietary, or otherwise private information. If you 
have received it in error, purge the message from your system and 
notify the sender immediately.  Any other use of the email by you 
is prohibited.
Thread
switching from varchar to tinytextJason Pyeron4 Sep
  • Re: switching from varchar to tinytextAlexey Polyakov4 Sep
    • Re: switching from varchar to tinytextJason Pyeron5 Sep
      • Re: switching from varchar to tinytextJason Pyeron5 Sep