IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Maximum number of records in table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Apr 01, 2009 5:12 pm
Reply with quote

Can we find out what will be maximum number of records one table can have?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 01, 2009 5:23 pm
Reply with quote

You can probably find that in a manual ... link at the top of the page.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 01, 2009 6:29 pm
Reply with quote

none, since db2 tables only have rows, there are no records in tables. that is a term used in files.

so, now that you know the correct terminology, your search for the answer is easier.

suggest you look at the manuals covering design of tables, since the answer is dependent on allocation.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Apr 01, 2009 7:40 pm
Reply with quote

Our DBAs always ask "how many rows will you have in your table" so they can allocate enough space in the table.
Maybe your DBA has a formula for quick calculation.
Don't forget that it will always be an approximation, as DB2 tables are stored in VSAM files that can have many EXTENTs.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 01, 2009 10:01 pm
Reply with quote

Hello,

Quote:
Can we find out what will be maximum number of records one table can have?
I suspect that many of us each took a different meaning to your question.

What is it you really want to know? Some possibilities are:
. the maximum number of rows that can ever be in a table.
. the maximum number of rows for for some specific table.
. the most rows some table has ever held.
. something else. . .

If you explain how you would use the answer, it may help someone provide a more useful reply.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 02, 2009 8:19 am
Reply with quote

Hi All, thanks for inputs..


@Dick,

I want to know maximum number of rows for some specific table if i know the allocation of tablespace and tablespace is having only that table.

If one row of table is n bytes, is there any way to maximum number of rows table can have?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Apr 02, 2009 8:51 am
Reply with quote

Hello,

You should be able to get an approximate number by dividing the total space (mbytes) by the number of bytes in one row.

One way to get a more accurate number would be to create a clone table that is only 10% (or even 1% if the table is huge) of the current allocation. Make sure the clone/test area does not auto-extend. Insert rows until the space is full and keep a count of rows inserted. When the space fills, display the number inserted. Multiply the number by 10 or 100 depending on how you sized the test table.

Someone else may have a more elegant suggestion icon_smile.gif
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Fri Apr 03, 2009 1:05 am
Reply with quote

Hi Sambhaji

To find the number of row that can be accommodated in a table depends on various factors. You can not simply add the number of bytes in a row. As you may aware that rows are stored in pages of size 4 to 32 k. Normally 4 K size. The entire 4 K (4096 bytes) can not be used for storing data. There are overheads in the form of Page header and Page trailer.
The storage for a row is also need some consideraion. VARCHAR column needs 2 bytes extra apart form the maximum size and NULLable column need 1 byte extra. There may be free space declared at the time of defining the tablespace. There are pages where rows can not be inserted( Header page, Spacemap page etc). More over the maximum number of rows in a page(4K) is limited to 255 even though the size of the row is so small. And finally the space allocation in terms of KB for Primary and Secondary quantity. Depending on the DB2 version the number of allocation also will vary, so the size of the table/space.

I think I confused you. Better you contact your DBA for a clarification

Regards
Raghu
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 03, 2009 1:15 am
Reply with quote

Raghu,

an excellent post.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top