473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Small & Large Lobs

Given I have binary input which is to be stored in one table, and it
may consist of any size -- ie, VARCHAR(n) FOR BIT DATA, WHERE THE n is
less than 32K, or the n is bigger such that it is a BLOB ...

Given that I have a LOB table too, named LOBTABLE,

Is there any problem with,

CREATE TABLE(
ID INTEGER NOT NULL,
DATA VARCHAR(31k) FOR BIT DATA,
LOB ADDRESS,
.....
LOB IN LOBTABLE
.....

Would there be a problem in storing either or both data types,
retrieving them, sorting them, etc.

Nov 12 '05 #1
4 1890
Stanley Sinclair wrote:
Given I have binary input which is to be stored in one table, and it
may consist of any size -- ie, VARCHAR(n) FOR BIT DATA, WHERE THE n is
less than 32K, or the n is bigger such that it is a BLOB ...

Given that I have a LOB table too, named LOBTABLE,

Is there any problem with,

CREATE TABLE(
ID INTEGER NOT NULL,
DATA VARCHAR(31k) FOR BIT DATA,
LOB ADDRESS,
....
LOB IN LOBTABLE
....

Would there be a problem in storing either or both data types,
retrieving them, sorting them, etc.

This is a popular choice. You can also use COALESCE(DATA, LOB) (maybe in
a view) to make it transparent.

Note: No sorting LOBs, no comparison functions for these puppies
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Thanks, this looks good, but . . .

I'm worried about that COALESCE. To remind: this is a case where a
row will contain either a VARCHAR or a BLOB. Using a view with
COALESCE(VARCHAR, BLOB) . . . will a BLOB be searched for even if there
is a null BLOB address in the base table?

SS

Nov 12 '05 #3
28******@gmail.com wrote:
Thanks, this looks good, but . . .

I'm worried about that COALESCE. To remind: this is a case where a
row will contain either a VARCHAR or a BLOB. Using a view with
COALESCE(VARCHAR, BLOB) . . . will a BLOB be searched for even if there
is a null BLOB address in the base table?


I'm not 100% sure, but I think it will be read from disk, just consider this
example:

$ db2 "values coalesce(1, 1 / 0)"
SQL0801N Division by zero was attempted. SQLSTATE=22012

So you could change the coalesce to:

SELECT <varchar>
FROM <table>
WHERE <varchar> IS NOT NULL
UNION ALL
SELECT <blob>
FROM <table>
WHERE <varchar> IS NULL

The question is, however, how to align the data types. But you also have
the same issue with the VARCHAR and the BLOB in the COALESCE.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #4
Knut Stolze wrote:
28******@gmail.com wrote:

Thanks, this looks good, but . . .

I'm worried about that COALESCE. To remind: this is a case where a
row will contain either a VARCHAR or a BLOB. Using a view with
COALESCE(VARCHAR, BLOB) . . . will a BLOB be searched for even if there
is a null BLOB address in the base table?

I'm not 100% sure, but I think it will be read from disk, just consider this
example:

$ db2 "values coalesce(1, 1 / 0)"
SQL0801N Division by zero was attempted. SQLSTATE=22012

So you could change the coalesce to:

SELECT <varchar>
FROM <table>
WHERE <varchar> IS NOT NULL
UNION ALL
SELECT <blob>
FROM <table>
WHERE <varchar> IS NULL

The question is, however, how to align the data types. But you also have
the same issue with the VARCHAR and the BLOB in the COALESCE.

Also keep in mind that NULL is stored in the row.
The LOB content is stored doutside of the row.
A NULL LOB doesn't even have a pointer to the out-of row space, so it
simply CANNOT be more expensive than going to teh row.
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Janne Ruuttunen | last post by:
Hello DB2 people, I'm having problems exporting >= 250000 lobs to IXF files with the LOBSINFILE option, using a legacy DB2 2.1 system on Win NT. If I don't specify a path for the lobs,...
9
by: Remove the obvious for replies | last post by:
Recently I have converted from UDB 7.2 (NT) to UDB 8.1.4 (W2K) and have noticed a critical error W.R.T. our VB/ADO apps. If I use the 7.2 client, then everything (except calls to federated...
9
by: Rom Marshall | last post by:
Hi. Once a LOB size goes beyond 32KB in size, I'm not able to use the LOAD utility to unload the data off the tables for DB2 7.1 on OS/390. Instead, the documentation refers to a sample C++...
10
by: Alex Greem | last post by:
Dear all, Our database (DB2 Workgroup 7.2 FP12) is constantly under heavy load. Most time CPU usage (1 Pentium3 1Ghz) is more 50% busy. We have 3GB RAM memory Our normal workload is 200-300...
1
by: stoat2337 | last post by:
I'm looking to purge rows from a DB2 table that contains both a CLOB (1M) and BLOB (51K), but our DBA is not familiar with LOBs. I work on a mainframe (z/OS), and we don't normally use LOBs in our...
5
by: Louis LeBlanc | last post by:
Hey folks. I'm new to the list, and not quite what you'd call a DB Guru, so please be patient with me. I'm afraid the lead up here is a bit verbose . . . I am working on an application that...
2
by: Luc | last post by:
I saw a few posts on this newsgroup about it but nothing to help me resolve this problem: We designed a window in .NET on a platform using small fonts (120 ppp). But this window will run on...
4
by: =?Utf-8?B?VzFsZDBuZTc0?= | last post by:
When one architects a new project one of the first steps in the decision is to decide on the layers. (In my opinion anyway) One architecture that I have used before is to go solid OO and create...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.