On Friday, November 23, 2012 10:30:28 AM UTC+1, Lennart Jonsson wrote:
> On 11/23/2012 10:07 AM, Lennart Jonsson wrote:
>> On 11/23/2012 12:56 AM, TheBoss wrote:
>> [...]
>>>
>>> select �REORG TABLE � || TABSCHEMA || �.� || TABNAME || � INPLACE ALLOW
>>> WRITE ACCESS;�
>>> from sysibmadm.snaptab
>>> where (ROWS_READ > 999)
>>> AND (((OVERFLOW_ACCESSES * 100) / (ROWS_READ + 1) > 3)
>>>
>>
>
> Jeroen, I hit the send button to fast. I believe the idea behind this is
> slightly different from what the OP had in mind. Scotts formula will
> detect that data is fragmented due to manipulation of content, say
> update of varchar columns. I think what the OP is interested in is to
> determine whether he will run into:
>
> SQL0668N Operation not allowed for reason code "<reason-code>" on table
> "<table-name>".
>
> when the table is accessed. This is typicaly caused by destructive
> operations such as alter <table> drop <column>. AFAIK you can do a
> number of such operations (I've seen the number 3 somewhere) before you
> run into SQL0668N. I don�t think you will encounter that due to
> manipulation of data. Adding a column will probably cause overflows, so
> in that case Scotts formula will alert for possible SQL0668N.
>
> /Lennart
Ah, yes, thanks for that.
I fully concentrated on the OP's request for an alternative way of checking for tables in need of reorganisation.
I didn't even notice he mentioned SQL0668N, I should have checked that first.
Regarding your remark in the other reply:
I fully agree NULLIF is conceptually a neater way to avoid dividing by zero.
I'll evaluate all my "DBI" scripts for this to see if there may be is any performance reason why Scott prefers to use the '+1'-trick ;-)
Cheers!
--
Jeroen