473,466 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Index creation

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
Nov 12 '05 #1
8 4887
This is for Version 8.1.4
http://publib.boulder.ibm.com/infoce...n/r0000919.htm

PM

"dbamota" <db***@nashfinch.com> a écrit dans le message de
news:a8**************************@posting.google.c om...
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

Nov 12 '05 #2
"dbamota" <db***@nashfinch.com> wrote in message
news:a8**************************@posting.google.c om...
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


The tablespace used for an index depends how the table was defined. If the
create table specified a separate tablespace is to be used for indexes on
that table, then the named tablespace will be used for all indexes on the
that table. Otherwise, the indexes will be placed in the same tablespace as
the table. Check the SQL Reference manual.
Nov 12 '05 #3
Raj's question is not answered. He wants to know if, regardless of
what kind of tablespace is used, an index based on a string is as
efficient as an index based on an integer.

Also, if using a string in an index, is a VARCHAR as efficient as a
CHAR.

(I am adding:) Does the answer depend on how large the index is? Eg,
less than 20,000 rows vs more than 100,000 rows?
Nov 12 '05 #4
Raj's question is not answered. He wants to know if, regardless of
what kind of tablespace is used, an index based on a string is as
efficient as an index based on an integer.

Also, if using a string in an index, is a VARCHAR as efficient as a
CHAR.

(I am adding:) Does the answer depend on how large the index is? Eg,
less than 20,000 rows vs more than 100,000 rows?
Nov 12 '05 #5
You posted to the wrong thread i think...

PM
"Stanley Sinclair" <st*************@bellsouth.net> a écrit dans le message
de news:6f**************************@posting.google.c om...
Raj's question is not answered. He wants to know if, regardless of
what kind of tablespace is used, an index based on a string is as
efficient as an index based on an integer.

Also, if using a string in an index, is a VARCHAR as efficient as a
CHAR.

(I am adding:) Does the answer depend on how large the index is? Eg,
less than 20,000 rows vs more than 100,000 rows?

Nov 12 '05 #6
You posted to the wrong thread i think...

PM
"Stanley Sinclair" <st*************@bellsouth.net> a écrit dans le message
de news:6f**************************@posting.google.c om...
Raj's question is not answered. He wants to know if, regardless of
what kind of tablespace is used, an index based on a string is as
efficient as an index based on an integer.

Also, if using a string in an index, is a VARCHAR as efficient as a
CHAR.

(I am adding:) Does the answer depend on how large the index is? Eg,
less than 20,000 rows vs more than 100,000 rows?

Nov 12 '05 #7

"Stanley Sinclair" <st*************@bellsouth.net> wrote in message
news:6f**************************@posting.google.c om...
Raj's question is not answered. He wants to know if, regardless of
what kind of tablespace is used, an index based on a string is as
efficient as an index based on an integer.
Indexes based on integers are usually "faster" than indexes based on char()
strings. This is simply because integer keys can be compared more quickly
than character strings.
Also, if using a string in an index, is a VARCHAR as efficient as a
CHAR.
VARCHARs will be slighly more efficient than CHARs, since the length of the
key is known ahead of time.
(I am adding:) Does the answer depend on how large the index is? Eg,
less than 20,000 rows vs more than 100,000 rows?


Potentially. More rows in the table may mean more levels in the btree
structure of the index. Each additional level requires another page to be
read from disk, as well as an extra set of key comparisons.

--
Matt Emmerton
DB2 OLTP Performance
IBM Toronto Lab
Nov 12 '05 #8

"Stanley Sinclair" <st*************@bellsouth.net> wrote in message
news:6f**************************@posting.google.c om...
Raj's question is not answered. He wants to know if, regardless of
what kind of tablespace is used, an index based on a string is as
efficient as an index based on an integer.
Indexes based on integers are usually "faster" than indexes based on char()
strings. This is simply because integer keys can be compared more quickly
than character strings.
Also, if using a string in an index, is a VARCHAR as efficient as a
CHAR.
VARCHARs will be slighly more efficient than CHARs, since the length of the
key is known ahead of time.
(I am adding:) Does the answer depend on how large the index is? Eg,
less than 20,000 rows vs more than 100,000 rows?


Potentially. More rows in the table may mean more levels in the btree
structure of the index. Each additional level requires another page to be
read from disk, as well as an extra set of key comparisons.

--
Matt Emmerton
DB2 OLTP Performance
IBM Toronto Lab
Nov 12 '05 #9

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

Similar topics

0
by: Guy Deprez | last post by:
Hi, i'm having a problem to create indexes. STEP 1 ----------- Connection is OK (you can find the string at the end of the message) Table ("Couleurs") creation is OK STEP 2. Index Creation
8
by: Andr? Queiroz | last post by:
Hi, I have a table with 10M records and col A has a index created on it. The data on that table has the same value for col A on all 10M records. After that I insert diferent values for that column...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
1
by: Markus Keuthmann | last post by:
Anybody knows a restriction for an index creation on a text column? How deep can an index for a text go? Somebody told me that a MySQL-Index has a restriction on 255 strings! And DB2? Is there...
4
by: Xela | last post by:
Hi I am facing the following problem. I load a fact table with around 25 millons lines, and 7 indexes. I load it with 3 million line subsets. I am on a quadriprocessor Solaris machine. The...
1
by: chettiar | last post by:
Hi, I am dropping an index and recreating it to lower the high water mark. The index creation is taking a lot of time. I am stuck as to why it does so. Is there any way that I can find out why...
2
by: db2udbgirl | last post by:
Hello, The create index statement executes for the past 1 hour while trying to add a new index to a logically partitioned table which has 58 million records. Is there a command/utilit where I can...
10
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
1
by: Picaso.Leonardo | last post by:
Hello all That works faster in Mysql for creation of an index: CREATE INDEX or ALTER TABLE tab ADD INDEX Thanks.
1
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.
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.