If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > 10 million data storage in db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-10, 16:01
krishnabemtech krishnabemtech is offline
Registered User
 
Join Date: Aug 2010
Posts: 2
Red face 10 million data storage in db2

I need to build a history table in DB2 (Version-9.1.5) with 8 columns which will queried frequently with all the 8 columns in its where clause. I dont have a primary key or coposite key to query this table. This table is expected to have around 10 million records in it. whats the best way to query it or shall i move this big table to data warehouse ? Pls advice.
Reply With Quote
  #2 (permalink)  
Old 08-09-10, 16:11
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
creating a partition table might make your queries run faster
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #3 (permalink)  
Old 08-09-10, 16:17
krishnabemtech krishnabemtech is offline
Registered User
 
Join Date: Aug 2010
Posts: 2
Thanks for your reply. But I think this might not work because...I have 8 columns and all are text data. The query will be built dynamically for eg: if the user wants to search with only one column in where condition we will query that column alone in this table which has 10 million records..similaryl if 8 columns are needed we will search with 8 columns in where condition.

Now your idea is to break the tables in to 2 or 3 means...data will be replicated and i wont have a primary key to join the tables..Pls advice...Else shall i give it to datawarehouse and will it be easy for us to access data from data warehouse.
Reply With Quote
  #4 (permalink)  
Old 08-09-10, 20:26
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
krishnabemtech, If you have no other information, you should probably create 8 indexes (1 on each column). This would cover any query on a Single column and DB2 can get a RID list from multiple indexes and AND/OR them to access the appropriate rows when multiple columns are use in the Where clause.

Another approach is to ask the people who will be querying the table how they do it. Is there a column or set of columns they 'always' use. If you can determine a tendency, you could create a multi-key index (or more than one) to handle the majority of the request and individual indexes on other columns.
Reply With Quote
  #5 (permalink)  
Old 08-10-10, 03:33
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Look at the number unique values for each column. Perhaps a MDC might be a good approach
Reply With Quote
  #6 (permalink)  
Old 08-10-10, 08:41
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
Quote:
Originally Posted by krishnabemtech View Post
Now your idea is to break the tables in to 2 or 3 means...data will be replicated and i wont have a primary key to join the tables..Pls advice...Else shall i give it to datawarehouse and will it be easy for us to access data from data warehouse.
Table partitioning does not use primary keys. You just need some meaningful column to partition your table. Most of the time it is month, quoter, or year column. Could be geo location too. Something to make your query run within limited number of partitions instead of scanning the whole table.
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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