Changeset 37cc390aaf0a314a2d270b3f3c274ff9acb09a1b

Show
Ignore:
Timestamp:
05/11/10 17:54:12 (8 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1273600452 +0000
git-parent:

[48eab20039f61d35464792f895cf8f8c1768ea5f]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1273600452 +0000
Message:

make this work faster on partitioned tables

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/sprocs/stratcon.window_robust_derive.sql

    r27d71aa r37cc390  
    1515  last_value numeric; 
    1616  run numeric; 
     17  v_sql text; 
     18  v_in_minus_5 timestamptz := in_start_time - '5 minutes'::interval; 
     19  v_in_minus_10 timestamptz := in_start_time - '10 minutes'::interval; 
     20 
    1721begin 
    1822 
     
    2428   run := 0; 
    2529   rec.rollup_time = in_start_time; 
    26    for r in SELECT sid, name, whence, 
    27                    (whence > in_start_time - '5 minutes'::interval) as in_window, 
     30   v_sql := 'SELECT sid, name, whence, 
     31                   (whence > '||quote_literal(v_in_minus_5)||'::timestamptz) as in_window, 
    2832                   value 
    29               FROM metric_numeric_archive 
    30              WHERE whence <= in_start_time 
    31                AND whence > in_start_time - ('5 minutes'::interval * 2) 
     33              FROM stratcon.loading_dock_metric_numeric_archive 
     34             WHERE whence <= '||quote_literal(in_start_time)||'::timestamptz 
     35               AND whence > '||quote_literal(v_in_minus_10)||'::timestamptz 
    3236          order BY sid,name,whence 
     37             '; 
     38 
     39  for r in EXECUTE v_sql 
    3340  loop 
    3441  if (rec.sid is not null and rec.name is not null) and