dbTalk Databases Forums  

REORG Confusion

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss REORG Confusion in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fin
 
Posts: n/a

Default REORG Confusion - 02-23-2011 , 11:44 PM






Firstly I must admit to being constantly confused by the sheer scale
of REORG complexities on both tables and indexes.

I have a table that when I run 'CALL
SYSPROC.REORGCHK_IX_STATS('T','USER')' on produces ***-- as F4, F5,
F6, F7, F8 results on two (2) of the 5 indexes on the table.

I then run ;
CALL SYSPROC.ADMIN_CMD('REORG INDEXES ALL FOR TABLE x');
CALL SYSPROC.ADMIN_CMD('RUNSTATS ON TABLE x ON KEY COLUMNS WITH
DISTRIBUTION ON KEY COLUMNS AND DETAILED INDEXES ALL ALLOW READ
ACCESS');

I then run 'reorgchk update statistics on table x;' which shows
results *---- as F4, F5, F6, F7, F8 for the indexes.

If I now re-run 'CALL SYSPROC.REORGCHK_IX_STATS('T','USER')' table x
is still showing ***-- as a result, where the REORGCHK results are
something completely different ?

Am I missing something here ? When do the stats for
SYSPROC.REORGCHK_IX_STATS get updated and where do they come from ?.
If I have reorg'd and runstats shouldn't they be updated especially if
I have also run reorgchk with updated stats on the same table ?

Reply With Quote
  #2  
Old   
danfan46
 
Posts: n/a

Default Re: REORG Confusion - 02-24-2011 , 01:49 AM






On 2011-02-24 06:44, Fin wrote:
Quote:
Firstly I must admit to being constantly confused by the sheer scale
of REORG complexities on both tables and indexes.

I have a table that when I run 'CALL
SYSPROC.REORGCHK_IX_STATS('T','USER')' on produces ***-- as F4, F5,
F6, F7, F8 results on two (2) of the 5 indexes on the table.

I then run ;
CALL SYSPROC.ADMIN_CMD('REORG INDEXES ALL FOR TABLE x');
CALL SYSPROC.ADMIN_CMD('RUNSTATS ON TABLE x ON KEY COLUMNS WITH
DISTRIBUTION ON KEY COLUMNS AND DETAILED INDEXES ALL ALLOW READ
ACCESS');

I then run 'reorgchk update statistics on table x;' which shows
results *---- as F4, F5, F6, F7, F8 for the indexes.

If I now re-run 'CALL SYSPROC.REORGCHK_IX_STATS('T','USER')' table x
is still showing ***-- as a result, where the REORGCHK results are
something completely different ?

Am I missing something here ? When do the stats for
SYSPROC.REORGCHK_IX_STATS get updated and where do they come from ?.
If I have reorg'd and runstats shouldn't they be updated especially if
I have also run reorgchk with updated stats on the same table ?
The algorithm that checks if a reorg is needed, does not work for small tables.
What is the number of rows, and rowsize for those tables?
/dg

Reply With Quote
  #3  
Old   
Fin
 
Posts: n/a

Default Re: REORG Confusion - 02-24-2011 , 10:34 AM



Record count: 409k records

Table def:

col_1 INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
col_2 VARCHAR (250) NOT NULL,
col_3 DATE NOT NULL DEFAULT CURRENT DATE,
col_4 VARCHAR (250),
col_5 VARCHAR (250),
col_6 VARCHAR (250),
col_7 VARCHAR (250),
CONSTRAINT con_a PRIMARY KEY (col_1, col_2, col_3),
CONSTRAINT con_b UNIQUE (col_2)

Index:
CREATE UNIQUE INDEX ind_c
ON tab_a (col_2 DESC, col_1) ALLOW REVERSE SCANS;

Indexes in question:
Constraint con_b
Index ind_c

Both report ***-- as F4/5/6/7/8 in response to
SYSPROC.REORGCHK_IX_STATS following a reorg indexes all for table
tab_a.
Following reorg on the indexes, I have also tried to reorg the table,
runstats and rebind. Still same result.

Reply With Quote
  #4  
Old   
Sharif
 
Posts: n/a

Default Re: REORG Confusion - 03-06-2011 , 05:57 AM



On Feb 24, 10:34*pm, Fin <tdavi... (AT) hotmail (DOT) com> wrote:
Quote:
Record count: 409k records

Table def:

col_1 *INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
col_2 *VARCHAR (250) NOT NULL,
col_3 *DATE NOT NULL DEFAULT CURRENT DATE,
col_4 *VARCHAR (250),
col_5 *VARCHAR (250),
col_6 *VARCHAR (250),
col_7 *VARCHAR (250),
CONSTRAINT con_a PRIMARY KEY (col_1, col_2, col_3),
CONSTRAINT con_b UNIQUE (col_2)
Dear concern,
can anytell me how to grant reorg to any user, i used folowing
command
db2 => grant reorg on database DB_NAME to USR_NAME;

but it shows following error.

DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "reorg" was found following "grant ".
Expected
tokens may include: "READ". SQLSTATE=42601

can anyone please help me on this?

Regards,
Ikhtear
Quote:
Index:
CREATE UNIQUE INDEX ind_c
* * * * ON tab_a (col_2 DESC, col_1) ALLOW REVERSE SCANS;

Indexes in question:
Constraint con_b
Index ind_c

Both report ***-- as F4/5/6/7/8 in response to
SYSPROC.REORGCHK_IX_STATS following a reorg indexes all for table
tab_a.
Following reorg on the indexes, *I have also tried to reorg the table,
runstats and rebind. Still same result.

Reply With Quote
  #5  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: REORG Confusion - 03-06-2011 , 10:38 AM



On 2011-03-06 12:57, Sharif wrote:
[...]
Quote:
can anytell me how to grant reorg to any user, i used folowing
command
If you look at the documentation you will find a paragraph named
Authorization. For 9.5 LUW the content is:

Authorization
One of the following:
sysadm
sysctrl
sysmaint
dbadm
CONTROL privilege on the table.

You need to grant one of those to the users/groups that should be able
to do reorg. It's probably a bad idea to give everyone these rights.

[...]

/Lennart

Reply With Quote
  #6  
Old   
Bruce
 
Posts: n/a

Default Re: REORG Confusion - 04-06-2011 , 06:21 AM



On Mar 6, 12:38*pm, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com>
wrote:
Quote:
On 2011-03-06 12:57, Sharif wrote:
[...]



can anytell me how to grant reorg to any user, i used folowing
command

If you look at the documentation you will find a paragraph named
Authorization. For 9.5 LUW the content is:

Authorization
One of the following:
sysadm
sysctrl
sysmaint
dbadm
CONTROL privilege on the table.

You need to grant one of those to the users/groups that should be able
to do reorg. It's probably a bad idea to give everyone these rights.

[...]

/Lennart
Can somebody at IBM amplify on danfan46's statement that "The
algorithm that checks if a reorg is needed, does not work for small
tables"?

Is this true IBM?

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.