Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 06:31 AM
Pascal Damian
Guest
 
Posts: n/a
Default Index on CHAR(N) FOR BIT DATA?

Since DB2 can't index BLOB/CLOB, can it index CHAR(N) FOR BIT DATA,
especially for storing GUID primary keys.

(Sorry, I don't use DB2 actually).
  #2  
Old November 12th, 2005, 06:31 AM
Serge Rielau
Guest
 
Posts: n/a
Default Re: Index on CHAR(N) FOR BIT DATA?

Absolutely. Is it truly teh whole LOB you need to index?
One thing you may look into is a generated column.
.... lobheader VARCHAR(100) GENERATED ALWAYS AS (CAST(SUBSTR(clobcol, 1,
100))
then index the header and search by it.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
  #3  
Old November 12th, 2005, 06:31 AM
Pascal Damian
Guest
 
Posts: n/a
Default Re: Index on CHAR(N) FOR BIT DATA?

Serge Rielau <srielau@ca.eye-be-em.com> wrote in message news:<c02sq4$hs6$1@hanover.torolab.ibm.com>...[color=blue]
> Absolutely. Is it truly teh whole LOB you need to index?
> One thing you may look into is a generated column.
> ... lobheader VARCHAR(100) GENERATED ALWAYS AS (CAST(SUBSTR(clobcol, 1,
> 100))
> then index the header and search by it.[/color]

Thanks, Serge. I never actually have the need to index (B-tree) a very
long string (hundreds to thousands of bytes). But in this case I want
to index CHAR(16) FOR BIT DATA to store 128-bit GUID. I don't want to
use CHAR and store GUID in base64/hex encoding because that would
waste some space (22-32 bytes instead of just 16).

In Postgres I can already index BYTEA and in SQL Server I can index on
BINARY/VARBINARY.

--
Pascal
  #4  
Old November 12th, 2005, 06:31 AM
Serge Rielau
Guest
 
Posts: n/a
Default Re: Index on CHAR(N) FOR BIT DATA?

No problem then. (VAR)CHAR FOR BIT DATA will do what you need.
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.