MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Index only

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Mon Feb 28, 2011 8:11 am    Post subject: Index only Reply with quote

I have a huge table, MyTable, with some fields, Field1, Field2, Field3.

All fields are included in a index, some statements access the table by the index (index only access, matchcols > 0).

The data (each row) is stored twice, in the dataset for the table and in the dataset for the index.

The storage for the table is not used, not accessed.

My question is: Is there any datacontainer, possibility, using DB2 for z/OS just to hold the Index Tree (B-Tree) with Update, Insert, Delete operations and not waste storage the table ?

So I want just to handle the index tree and save disk storage.

Any comments please ?


regards,
bauer
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Feb 28, 2011 2:15 pm    Post subject: Reply with quote

Queries might be optimized to refer only to the index, but the data still needs to be stored. . .

This is not a problem - it is the way db2 is designed. An index is made up of the content of one or more columns. . .
_________________
All the best,

di
Back to top
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Tue Mar 01, 2011 2:54 am    Post subject: Reply with quote

Thank you for your reply.

The intention of my question was, just to find a easy way to handle the datastructure of a b-Tree. In my situation a b-Tree which is very large an can not be kept in memory.

regards,
bauer
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Tue Mar 01, 2011 3:25 pm    Post subject: Reply with quote

Suggest you insert the rows with the data and then query against them.

Why does someone believe there is a need for some externally maintained b-tree Confused

What needs to be accomplished that "regular" rows and queries will not support?
_________________
All the best,

di
Back to top
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Tue Mar 01, 2011 6:15 pm    Post subject: Reply with quote

Well. regular rows / queries support the requirements.

But the topic is the waste of storage, because I'm talking about tables with several millions ( 200 - 300 ) of rows. The rows are only some integer values, all included to the index of the table.

If it would be possible to store the index only, without storing the basetable, it would require only 50% (approx.) of disk storage.

But thank you very much again for answering.
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Tue Mar 01, 2011 11:29 pm    Post subject: Reply with quote

You're welcome Smile

Someone may be able to provide suggestions if you post the specifics of what is to be accomplished. The requirement posted is quite generic so far.

What data is contained in these 3 columns? What relationships to any ofhter tables exist?

One way to do what you describe might be to implement outside the database using some kind of bdam file where only 1 set of the data was needed. This would be completely outside of the database processing and sql which might make this very unattractive. And there would always be the risk that additional features/functions could be added to the applicatoin requiring a complete re-do of the "special" b-tree.

Is there some way to partition these many millions of rows? Do all of the rows need to be online/available all of the time?
_________________
All the best,

di
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Wed Mar 02, 2011 1:25 pm    Post subject: Reply with quote

bauer wrote:
If it would be possible to store the index only, without storing the basetable, it would require only 50% (approx.) of disk storage.


Why 50%?

Isn't indexing supposed to maintain just list of range of indexes for each page so that depending on the value you know which page to look? To me it's like table of contents of a book, which represents the entire book without repeating everything.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Wed Mar 02, 2011 1:46 pm    Post subject: Reply with quote

Why 50% ?

My answer:

In the table I have 3 columns of integer = 3 * 4 = 12 Byte, the table contains n rows (n very large), so tablespace is 12 * n Byte (plus some DB2 internal maintenace data).

In the Index I have the 3 Columns, 3 * 4 = 12 Byte plus referenz to the row (RowId) plus some data to maintain the b Tree. So Indexspace = 12 * n Byte.

Only the index is accessed, the algorithm which deals with the data only operates on the index (explain: Index Only Access).

So if it would be possible to handle the datastructure "B Tree" without the depended table, is would be possible to save disk storage.


The scenario is some kind of datawarehouse, searchengine, this is the reason for the huge table. An 500 GB or 1000 GB diskstorage is a little bit a difference.

But ok, DB2 does not support handling of "basic data structures only". DB2 is not a toolkit for datastructures, DB2 is a relat. databasesystem.

regards,
bauer
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Wed Mar 02, 2011 3:53 pm    Post subject: Reply with quote

Dibakar wrote:

Why 50%?

Isn't indexing supposed to maintain just list of range of indexes for each page so that depending on the value you know which page to look? To me it's like table of contents of a book, which represents the entire book without repeating everything.


Sorry, I take it back. Didn't realize that DB2 actually keeps a list of all indexes.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Mar 03, 2011 8:45 am    Post subject: Reply with quote

First, DB2 doesn't work that way. Indexes are not standalone objects. They require tables. Tables can be created without indexes, but indexes cannot be created without tables. Look at the syntax,

Code:
CREATE INDEX <index-name> ON <table-name> ...

Second, don't be so certain about your calculations. DB2's strategy to create index entries is more complex. Index entries will normally be smaller than the number of bytes that comprise the key due to index compression algorithms. Also, your shop might be using compression dictionaries, so the data could be smaller too.

Finally, your table is only huge in your mind. Plug in the numbers using your calculations. That will provide you with an idea of worst case space usage with no index entry compression and no data compression. Why are you struggling to save 5GB?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group