Store text in BLOB?
Asked Answered
C

3

6

I'm making a little forum for my clans website. I'm wondering if I should store the thread text in TEXT or BLOB? Whats the difference? I've seen that phpBB does that.

What is BLOB anyway? cant find much about it on Google.

Christen answered 21/2, 2009 at 11:42 Comment(0)
L
6

A blob is just a bunch of bytes. An arbitrary number of bytes, nothing more.

If you were to store text as a blob, you'd have to worry about encoding (the process of translating text to bytes). But if you store things as text whatever database transport your using will make sure that the text stored in the database is properly encoded and decoded for both efficient storage and easy use.

If you're planning to store text, you should store text.

phpBB could implement text encoding and decoding themselves and that could be one reason to use blob instead of text. It's unlikely but sometimes text data types have a maximum length, the blob might be a work around for phpBB in this particular instance.

Lowminded answered 21/2, 2009 at 11:48 Comment(0)
B
4

Re the "what" - BLOB is Binary Large OBject; compare to CLOB: Character Large OBject. Different databases call them different things, though - for example, on SQL Server you have image/varbinary(max) for BLOB, and text/varchar(max) for CLOB.

If a system only supports a BLOB, then one option is to encode strings - for example using UTF8. This might be what is happening.

Braggart answered 21/2, 2009 at 11:48 Comment(0)
C
1

BLOB is for binary data. I don't know the reason why phpBB 3 stores everything in binary but I have noticed it myself. My guess is that they are compressing/encoding whatever they put into the database. You could try looking through the phpBB source code to see if there is any comments explaining it.

Curch answered 21/2, 2009 at 11:45 Comment(1)
Oh, that might be the reason why its search function is so bad.Voice

© 2022 - 2024 — McMap. All rights reserved.