Re: Urgent (Blobs and Smart Blobs)
Posted in 2005
Topics: Storage & Space Management, Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration, Logging & Checkpoints, Java & JDBC Development
prateek jain wrote:
> I want to know the difference between BLOB and SMART BLOB..
>
> Also bpagesize gives the page size of a blob... how do i find the
> pagesize of a smart blob
(I didn't regard OTC's response as particularly helpful, but then,
'urgent' questions are not particularly sensible either. See:
http://www.catb.org/~esr/faqs/smart-questions.html ).
And, in a separate email sent to me privately, someone else asked:
> Sir, If you could help me in understanding as to what is the
> difference between blobs and smart blobs (IDS version 9.40) it would
> be very nice. Even if you could provide me with a link on the
> internet that would be able to expain this difference to me in a
> simple language it would be very helpful.
<off-topic>
I'm in a grumpy mood tonight - but I've been pestered by private emails
several times this week by people with whom I've not corresponded
previously, and I'd rather that questions are asked in public forums
(such as comp.databases.informix or the IIUG mailing lists) where other
people can also answer the question. Yes, I usually endeavour to ensure
that questions eventually get answered - eventually. If you need an
answer quickly and you don't get a good answer from your chosen public
forum, you should probably contact IBM Tech Support. If you don't have
Tech Support, consider buying it - it makes life easier for all
concerned. Please don't send the questions direct to me unless you've
had enough dealings with me to know that it's OK. Yes, sometimes it is
OK, but not when the question is basically manual bashing. See the URL
above for how to raise questions after manual bashing doesn't help!
</off-topic>
To work!
A BYTE or TEXT blob is the old fashioned bag of bytes. You can store
it; you can fetch it; and you've almost finished with what you can do
with those types.
A BLOB or CLOB blob is a new-fangled smart blob - another sort of bag of
bytes. You can store it - indirectly. You can fetch it - indirectly.
Unless you're programming in C, you've just about finished with what you
can do with these types too. However, if you program in C, there is
quite a lot more you can do. You may be able to do some of the fancier
tricks in Java too.
BYTE and TEXT blobs can be stored IN TABLE; that is, in the same dbspace
as the data in the rest of the row. When that happens, the blob data is
on separate pages. IIRC, in table blobs are logged through the log files
and buffer pool - if the database has logging - and so you should be
cautious about using large blobs IN TABLE. Alternatively, BYTE and TEXT
blobs can be stored in blob spaces. Blob spaces are distinct from
dbspaces and sbspaces - smart blob spaces. Blob spaces can be specified
to use a large page size (for example, 64 KB). Blobs stored in blob
spaces are not logged through the buffer pool and logical log buffers;
they impose less burden on the logging system.
Smart blobs are stored only in sbspaces - smart blob spaces. IIRC,
these do not have a configurable page size; if you can configure the
page size, there's an option to onspaces to specify it, and I'd be
surprised indeed if both oncheck and onstat are silent on the page size.
Sbspaces (ess-bee-spaces) can be logged or unlogged per your request.
There are a variety of other tricky and interesting aspects to smart
blob storage, such as the possibility of having multiple rows reference
a single smart blob in storage - shared data.
(Dear Informix Tech Pubs: the 10.00 IDS Admin's Ref on 'onspaces' under
'sbspaces and temp sbspaces' says you can create up to 2047 spaces; I
believe that should be 32767. This was spotted in the HTML version - I
assume the PDF says the same. Please check for the same
(mis)information elsewhere in the chapter.)
If you want more information, you should probably read the manuals. For
example, the ESQL/C programmers manual has chapters on both BYTE/TEXT
and BLOB/CLOB manipulation. The SQL Reference has a summary. You'd
probably find more on BLOB/CLOB in the extensibility (UDT/UDR) manuals.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/
"Jonathan Leffler" <jleffler@earthlink.net> wrote > BYTE and TEXT blobs can be stored IN TABLE; that is, in the same dbspace > as the data in the rest of the row. When that happens, the blob data is > on separate pages. IIRC, in table blobs are logged through the log files > and buffer pool - if the database has logging - and so you should be > cautious about using large blobs IN TABLE. This becomes moot if the database is HDRed to a secondary server. In that you have no option but to store BYTE/TEXT in TABLE, otherwise they will not be replicated. This was true until 9.21. Donno whether subsequent versions changed it. In my list of Informix weakness, this one is right at top.