3 messages in com.mysql.lists.win32Re: Data Types| From | Sent On | Attachments |
|---|---|---|
| Joelle Tegwen | 09 Dec 2005 11:53 | |
| SGr...@unimin.com | 09 Dec 2005 12:22 | |
| Joelle Tegwen | 09 Dec 2005 13:16 |
| Subject: | Re: Data Types![]() |
|---|---|
| From: | Joelle Tegwen (tegw...@umn.edu) |
| Date: | 12/09/2005 01:16:13 PM |
| List: | com.mysql.lists.win32 |
"fred" "joe's bar and grill" "Sometimes people enter really really long text that goes on and on for ever. maybe they ever write a whole book. You know how some people are, they're just really verbose so even though most of the data is likely under 256 characters there's no way to guarantee that and the business rules don't allow for forcing this data to be short so you need a longer
data type."
is it like this: row 1: L=5 row 2: L=21 row 3: L=370
Yes, it's like this. Each field is individually sized and only takes up the appropriate ammount of storage on disk. This is not the case with the earlier versions of NDB tables. They were always fixed width but that has recently changed. Besides, I do not think you were asking about NDB's in-memory allocation scheme, were you?
NDB? I'm not sure what that means. We're using InnoDB if that matters. (?)
or is it row 1: L=370 row 2: L=370 row 3: L=370
This is an example of neither fixed-width or variable storage as you are asking the database to resize a storage location based on the largest length added to the database. It would be quite inefficient to program a database this way. Imagine if you had 10000 rows of data setup like this and added a new row where the text field was 400 characters long, you would have to resize all 10000 previous rows to match the new value. It's easier to either let each field have its own size (as above) or completely fixed throughout. The advantage of being completely fixed is in lookup speed. You always know exactly how far to move in memory/disk to get to a particular piece of data. The downside to completely fixed field sizes is that it wastes so much space.
Oh sure, that makes tons of sense when you mention it that way.
Good question!
Thanks! And thank you for your quick, helpful reply. Joelle Tegwen




