Changeset 17 for trunk/table_growth

Show
Ignore:
Timestamp:
07/01/08 18:14:52 (6 years ago)
Author:
robert
Message:

actual size need never be null, afaict

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/table_growth/otools.summarize_table_growth.sql

    r15 r17  
    99IF to_char(current_date,'dd') <> '01' THEN 
    1010    insert into otools.table_growth (table_owner, schema_name, table_name, actual_size, growth_size, sum_flag, capture_time) 
    11     select a.table_owner, a.schema_name, a.table_name, a.actual_size, CASE WHEN b.actual_size IS NULL then 0 else a.actual_size-b.actual_size END AS table_growth, 1, a.capture_time 
     11    select a.table_owner, a.schema_name, a.table_name, a.actual_size, a.actual_size-b.actual_size AS table_growth, 1, a.capture_time 
    1212    from otools.table_growth a  
    1313        left join otools.table_growth b  
     
    2121-- Monthly summarization 
    2222IF to_char(current_date,'dd') = '01' THEN 
    23     insert into otools.table_growth (table_owner, schema_name, table_name, growth_size, sum_flag, capture_time) 
    24     select a.table_owner, a.schema_name, a.table_name, sum(growth_size), 2, (current_date - '1 month'::interval)  
     23    insert into otools.table_growth (table_owner, schema_name, table_name, actual_size, growth_size, sum_flag, capture_time) 
     24    select a.table_owner, a.schema_name, a.table_name, actual_size, sum(growth_size), 2, (current_date - '1 month'::interval)  
    2525    from otools.table_growth a  
    2626    where sum_flag=1 and capture_time between (current_date - '1 month'::interval) and current_date  
    27     group by table_owner, schema_name, table_name
     27    group by table_owner, schema_name, table_name, actual_size
    2828    -- now remove older rows 
    2929    delete from otools.table_growth where sum_flag = 1;