Forum Moderators: open

Message Too Old, No Replies

Choosing the right Data Type

         

adammc

4:25 am on Apr 12, 2007 (gmt 0)

10+ Year Member



Hi guys,

Can anyone advise me on the best date type to use for storage of html text. (page source)

Januuski

4:42 am on Apr 12, 2007 (gmt 0)



what db do you have?
use varchar if under 8000 characters

Discovery

9:01 am on Apr 12, 2007 (gmt 0)

10+ Year Member



i think text would be correct, because most to the cms using text data type to store content.

any other suggestion?

adammc

10:52 am on Apr 12, 2007 (gmt 0)

10+ Year Member



Thanks for the reply.

Im using a MYSQL DB.
I thought that varchar could only have a max of 200 chars?

What are the benefits of using longtext long blob and blob?

justageek

3:06 pm on Apr 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I thought that varchar could only have a max of 200 chars?

As long as you are using 5.0.3 and above you can make a varchar up to 65535 characters long. It'll be less if you have more columns since 65535 is the max row size as well.

What are the benefits of using longtext long blob and blob?

Longtext just allows a lot of characters. Blob and long blob store the same binary data but just have different storage limits.

If you do not have to search through the html pages you are storing then I suggest you compress them before you store them since most html pages are bloated with whitespace anyway.

JAG

adammc

10:24 pm on Apr 12, 2007 (gmt 0)

10+ Year Member



Hi justageek,

"I suggest you compress them before you store them since most html pages are bloated with whitespace anyway."
How do i do this?

My host is running - MySQL version 4.1.21-standard

justageek

10:41 pm on Apr 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use your favorite language. I use PHP for the most part so I use the zlib compression functions to compress the data before I store it in the db.

JAG

adammc

10:49 pm on Apr 12, 2007 (gmt 0)

10+ Year Member



So because My host is running - MySQL version 4.1.21-standard ....

Should I use long text?

Discovery

5:29 am on Apr 13, 2007 (gmt 0)

10+ Year Member



Yeah, I think long text is good option for you.

and ,

I use PHP for the most part so I use the zlib compression functions to compress the data before I store it in the db.

that the great tip by justageek.