how to choose between clob blob text byte...
Posted in 2016
Topics: Data Types & Schema Design
Hi. Is there any guide or general rules to help choosing between right data type? When to stop using char and start using varchar, when to stop using lvarchar and start using text or something like it. How to choose between blob, clob, text, byte, verylongvarchar... I'm thinking about this different situations, but you can add and remove as you think it's right: Size Lots of writes Lots of reads Lots of updates Need to compare the field or see inside. Backups/restore problems with some type? Thanks a lot in advance.
Some rules of thumb: - Performance wise, char, varchar, & lvarchar are about the same for the same sized column. - Prefer char if the column will usually be full or nearly so. - Prefer varchar or lvarchar of the column will be mostly empty for most rows as longa s the max size is something reasonable (ie <<pagesize - lvarchar(100) is OK lvarchar(20000) is probably not). - For overall performance avoid huge lvarchars that are mostly empty and use a child table with a reasonably sized char and a sequence number instead. - It is OK to use a huge lvarchar instead of a TEXT or CLOB column to simplify application code if the column is normally mostly filled. But consider the new, undocumented, longlvarchar as it stores invisible in a CLOB if it grows longer than 2K and doesn't require any special programming. For TEXT -vs- CLOB and BYTE -vs- BLOB I don't have any really good advice. CLOB and BLOB allow for fetching parts of a value and can be shared across multiple rows in different tables. TEXT and BYTE cannot but programming for them is simpler. Art Art S. Kagel, President and Principal Consultant ASK Database Management www.askdbmgt.com Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Fri, Jan 29, 2016 at 4:10 AM, JACOBO BALBUENA <jacobo.bc@gmail.com> wrote: > Hi. > > Is there any guide or general rules to help choosing between right data > type? > When to stop using char and start using varchar, when to stop using > lvarchar > and start using text or something like it. > How to choose between blob, clob, text, byte, verylongvarchar... > > I'm thinking about this different situations, but you can add and remove as > you think it's right: > > Size > Lots of writes > Lots of reads > Lots of updates > Need to compare the field or see inside. > Backups/restore problems with some type? > > Thanks a lot in advance. > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --001a1132f2144296f5052a782df7