473,659 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creation of Indexes in UDB for LUW

Hi -

I would be grateful for guidance regarding the following.

(Please note that my DB2 backgorund is principally OS/390. I have only
recently become involved in DB2 for LUW).

OVERVIEW
I have been using Scripted Files to Create Tables and an associated
Primary Indexe via the DB2 Command Window.

Within the Table DDL, if I only specify Primary Key, UDB automatically
creates a Primary Index.
However, it assigns the Index to the Scheme "SYSIBM" instead of the
Schema associated with the Table.
The assigned Index name is automatically generated and is meaningless.
In order to ensure that the Schema is the same as the Table and that
the Index name is meaningful, I prefix the Primary Key with the
"Constraint " parameter followed by the explicit Index name.

This avoids the above mentioned negatives.
However, when querying the nature of the Index via the Control Centre,
the Cluster option is not ticked, implying that it is a non-clustered
index.

QUESTION
Therefore:-
How can the DDL be customised such that the Primary Key is generated
with:-
1) The same Scheme name as the Table
2) A Primary Index with an explicitly specified name, AND
3) The Primary Index is clustered.

Thanks

Nov 12 '05 #1
2 1738
<al**********@b tinternet.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi -

I would be grateful for guidance regarding the following.

(Please note that my DB2 backgorund is principally OS/390. I have only
recently become involved in DB2 for LUW).

OVERVIEW
I have been using Scripted Files to Create Tables and an associated
Primary Indexe via the DB2 Command Window.

Within the Table DDL, if I only specify Primary Key, UDB automatically
creates a Primary Index.
However, it assigns the Index to the Scheme "SYSIBM" instead of the
Schema associated with the Table.
The assigned Index name is automatically generated and is meaningless.
In order to ensure that the Schema is the same as the Table and that
the Index name is meaningful, I prefix the Primary Key with the
"Constraint " parameter followed by the explicit Index name.

This avoids the above mentioned negatives.
However, when querying the nature of the Index via the Control Centre,
the Cluster option is not ticked, implying that it is a non-clustered
index.

QUESTION
Therefore:-
How can the DDL be customised such that the Primary Key is generated
with:-
1) The same Scheme name as the Table
2) A Primary Index with an explicitly specified name, AND
3) The Primary Index is clustered.

Thanks

Create the unique index as clustered before you create the primary key. DB2
will use the existing unique index (it will give a warning in the create
primary key).

I don't understand why indexes cannot altered like in DB2 for z/OS. I hope
this will improved in 9.1.
Nov 12 '05 #2
al**********@bt internet.com wrote:
1) The same Scheme name as the Table
2) A Primary Index with an explicitly specified name, AND
3) The Primary Index is clustered.


For Q2 the documentation says:

"PRIMARY KEY ...(column-name,)
Defines a primary key composed of the identified columns. [...]
The name cannot be qualified.

For Q1: the primary key is always bound to the table scheme but created
in the SYSIBM space. Must be for historic reasons <g>

Bernd

--
"Ja, alles meine Herren" sprach Fürst Lichnowsky. "Ooch det roochen?"
"Ja, auch das Rauchen." "Ooch im Tiergarten?" "Ja, auch im Tiergarten
darf geraucht werden, meine Herren." Und so endeten die Barrikadenkämpf e
des 18. März in Berlin
Nov 12 '05 #3

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

Similar topics

1
4045
by: Maria | last post by:
We have 3 oracle instances running on different servers, all servers have the same O/S configuration and oracle has the same configuration as well ( I copied over the init's etc from each other) Oracle version is 8.1.7.4.0 and O/S is solaris 5.8. The databases are all the same we use distributed databases therefore links to copy data only between the three oracle servers. Then indexes are done locally on the database On server 1...
1
1535
by: Doron | last post by:
is there a setting that will ebnable uniform extent allocation upon creation of index/table by default ? if there isn't any default setting can you code it in? thanks, Doron
1
2258
by: Steve_CA | last post by:
Hi, The more I read, the more confused I'm getting ! (no wonder they say ignorance is bliss) I just got back from the bookstore and was flipping through some SQL Server Administration books. One says, that to get the best query performance, youi do two things:
9
1888
by: pheonix1t | last post by:
hello, I've been assigned to do performance tuning on an SQL2000 database (around 10GB in size, several instances). So far, I see a single RAID5 array, 4CPU (xeon 700MHZ), 4GB RAM. I see the raid5 as a bottleneck. I'd setup a raid 10 and seperate the logs, database and OS(win2k). The one thing that was a bit odd to me was that I was told this place doesn't use indexes. The company is a house builder. They are pretty
8
4900
by: dbamota | last post by:
What is the syntax in UDB db2, to create an index IX in table TBL "in tablespace TBSP" which is different from the tablespace of TBL ? TIA
14
19668
by: Jeff | last post by:
This is the first time that I remember ever having too many indexes on a table, but it has happened. I have en employees table and store in many places, on tables, the id of the employee that performed some action. Yes, I know, that could be in an audit trail but it isn't. For example, who printed a sales order, who processed it etc is stored on the sales orders table. Well, I have run out of indexes on the employees table when trying...
10
2692
by: lesperancer | last post by:
you start with a small application in access97, then you have more modules and more... and you reach the point where tables like 'item' and 'employee' reach the limit and you know there's more indexes required for RI to come does creating a RI programatically instead of the relationship window still consume one of the 32 indexes ? does access2000 / 2003 allow more indexes per table ?
1
1770
by: Picaso.Leonardo | last post by:
HELLO all That works faster in DB2 for creation of an index: CREATE INDEX or Alter Table tab ADD INDEX for Import? Thanks.
0
7584
MMcCarthy
by: MMcCarthy | last post by:
The more data you include in your tables the more you will need to have indexes to search and sort that data. However, there is a balance between having enough indexes and too many. Too many indexes will slow down the speed of updates on your records. Access presets a number of Indexes for you. If you look in Tools ... Options under the Tables/Queries tab you will see that under "Auto Index on Import/Create" there is a list as follows: ...
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.