[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-win32
Subject:    Re: GIS In MySQL Database
From:       "Petr Vileta" <petr () practisoft ! cz>
Date:       2006-02-18 20:38:01
Message-ID: 006901c634cb$b149ff60$6401a8c0 () petr1
[Download RAW message or body]

> Wouldn't it be a more efficient use of disk space to store it as a
> char or varchar than as a blob?  Thanks,
>
Maybe, if you have many rows. Varchar and Blob is variable length fields, 
but Blob use string_length +2 bytes and Varchar use string_length +1 byte 
only.

This say the MySQL manual:

6.2.6.3 Storage requirements for string types
      Column type  Storage required
      CHAR(M)  M bytes, 1 <= M <= 255
      VARCHAR(M)  L+1 bytes, where L <= M and 1 <= M <= 255
      TINYBLOB, TINYTEXT  L+1 bytes, where L < 2^8
      BLOB, TEXT  L+2 bytes, where L < 2^16
      MEDIUMBLOB, MEDIUMTEXT  L+3 bytes, where L < 2^24
      LONGBLOB, LONGTEXT  L+4 bytes, where L < 2^32
      ENUM('value1','value2',...)  1 or 2 bytes, depending on the number of
enumeration values (65535 values maximum)
      SET('value1','value2',...)  1, 2, 3, 4 or 8 bytes, depending on the
number of set members (64 members maximum)

VARCHAR and the BLOB and TEXT types are variable-length types, for which the
storage requirements depend on the actual length of column values
(represented by L in the preceding table), rather than on the type's maximum
possible size. For example, a VARCHAR(10) column can hold a string with a
maximum length of 10 characters. The actual storage required is the length
of the string (L), plus 1 byte to record the length of the string. For the
string 'abcd', L is 4 and the storage requirement is 5 bytes.

The BLOB and TEXT types require 1, 2, 3, or 4 bytes to record the length of
the column value, depending on the maximum possible length of the type. See
section 6.2.3.2 The BLOB and TEXT Types.

Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail 
from another non-spammer site please.)





-- 
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe:    http://lists.mysql.com/win32?unsub=mysql-win32@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic