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 > Count of records not matching with card in partitioned database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-19-06, 02:15
ggnanaraj ggnanaraj is offline
Registered User
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 171
Count of records not matching with card in partitioned database

Scenario: In a DB2 V8.1 logically partitioned database (4 partitions) on Windows.

The count of the table is as follows:
D:\>db2 "select count(*) from admin.state with ur"

1
-----------
1450000

1 record(s) selected.


D:\>

However, the card from syscat.tables is as follows:

D:\>db2 "select substr(tabname, 1, 30), substr(tabschema,1,30), card, npages, fpages from syscat.tables where tabname like 'STATE%' with ur"

1 2 CARD NPAGES FPAGES
------------------------------ ------------------------------ -------------------- ----------- -----------
STATE ADMIN 40 8 8
STATEMENTS SYSCAT -1 -1 -1

2 record(s) selected.


D:\>

The db2nodes.cfg contents is as found below:

0 pcidl PCIDL 0
1 pcidl PCIDL 1
2 pcidl PCIDL 2
3 pcidl PCIDL 3



How do 1450000 & 40 relate? Why do they not match? Am I missing something in a partitioned database environment?

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 07-19-06, 03:46
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The stats in the DB2 catalog are only updated after you run runstats.

If the stats are -1, that means that runstats has never been run since the table was created.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390

Last edited by Marcus_A; 07-19-06 at 03:51.
Reply With Quote
  #3 (permalink)  
Old 07-19-06, 07:44
ggnanaraj ggnanaraj is offline
Registered User
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 171
Ofcourse, runstats is done, as shown below:

C:\>db2 "select stats_time from syscat.tables where tabname = 'STATE' with ur"

STATS_TIME
--------------------------
2006-07-19-14.24.27.828000

1 record(s) selected.


C:\
Reply With Quote
  #4 (permalink)  
Old 07-19-06, 13:54
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
In the db2 manuals, about RUNSTATS command :

"The command collects statistics for a table on the database partition from which it is invoked. If the table does not exist on that database partition, the first database partition in the database partition group is selected.
"
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 07-19-06, 23:55
ggnanaraj ggnanaraj is offline
Registered User
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 171
Thanks for the reply.

I have 1 coordinator node and 3 logical partitions on 1 single box.

The partitioning key is on 'bill'. The group by on this key is as follows:
Code:
D:\>db2 "select bill, count(*) from admin.state group by bill with ur"

BILL   2
----------- -----------
       8746          10
       7383        2830
       1918           5
       6530       40235
        200         960
        682      219305
       1910        2715
       2052     1182795
       9843        1145

  9 record(s) selected.

D:\>
I do not see how 40 is the card value for the above breakup on bill attribute.

Thanks in advance.
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