Blob woes
Posted in 1999
An interesting thing was pointed out to me recently. Let us suppose
we have a database on IDS 7.30UC5. Let us further suppose this
database has one table of the flavor:
create table tab1 (
cola char(2),
colb char(36),
data byte,
primary key(cola, colb)
);
Let us call the primary key index idx_pkey.
If you run:
select cola, colb from tab1 WHEREcola = 'E6'
AND colb >= 'PROG 123456789123456';
you get an index read. If you run
select cola, colb, data from tab1 WHEREcola = 'E6'
AND colb >= 'PROG 123456789123456';
you get a sequential scan. All the blobs are less than 1K in size. I
have so far tried the following to avoid the sequential scan:
Optimizzer directives (they weren't even ignored, they weren't
mentioned in sqexplain.out at all)
Update Statistics (as recommended in the book, as well as others)
Adding an index to just colb (no change)
Adding an index to just cola (no change, none expected)
using just the integer substring portion of colb (no change)
using the maximum value of colb (index path, yay!)
Has anyone seen this or know a workaround, other than a smaller result
set?
--
Rob Wilson
rwilson@ntsource.com