Unix Technical Forum

Optimizer's use of check Constraints ... ?

This is a discussion on Optimizer's use of check Constraints ... ? within the DB2 forums, part of the Database Server Software category; --> Hi, (DB2 LUW 8.2) Is the DB2 optimiser able to use check constraints ? e.g table1 ( name varchar(30) ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 08:37 AM
PaulR
 
Posts: n/a
Default Optimizer's use of check Constraints ... ?

Hi,

(DB2 LUW 8.2)

Is the DB2 optimiser able to use check constraints ?

e.g
table1
(
name varchar(30)
constraint c_upper check (name = UCASE(name))
)

CREATE INDEX table1_ix1 ON table1 (name ASC) ALLOW REVERSE SCANS;

would a query like

select * from table1 where ucase(name) = 'PAUL'

recognise that the index table1_ix1 was valid to be considered to be
used?

nb. at the moment we use indexed generated columns to achieve this.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 08:38 AM
Mark A
 
Posts: n/a
Default Re: Optimizer's use of check Constraints ... ?

PaulR wrote:
> Hi,
>
> (DB2 LUW 8.2)
>
> Is the DB2 optimiser able to use check constraints ?
>
> e.g
> table1
> (
> name varchar(30)
> constraint c_upper check (name = UCASE(name))
> )
>
> CREATE INDEX table1_ix1 ON table1 (name ASC) ALLOW REVERSE SCANS;
>
> would a query like
>
> select * from table1 where ucase(name) = 'PAUL'
>
> recognise that the index table1_ix1 was valid to be considered to be
> used?
>
> nb. at the moment we use indexed generated columns to achieve this.


The optimizer can use check constraints in some circumstances, such as
a UNION ALL view, but I don't think it would work in your example.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:06 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com