Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. SELECT h.epoch, h.system_id, m.id, m.name, m.tenant_unit_id, h.interval_mask, h.virtualspace_used AS pre_comp, h.post_comp_cumu
  2.  
  3. AS post_comp, h.post_comp_last_24_hours, 0 AS comp_factor FROM hd_processed_space_mtrees AS h JOIN cd_cfg_mtrees m ON h.system_id = m.system_id AND
  4.  
  5.  
  6. h.mtree_id = m.mtree_id JOIN (SELECT max(epoch) AS epoch, m.id, h.tier_type FROM hd_processed_space_mtrees h JOIN cd_cfg_mtrees m
  7. ON h.system_id = m.system_id AND h.mtree_id = m.mtree_id WHERE h.tier_type=0 AND
  8. m.id IN (1, 2, 32, 33, 38, 39, 37, 42, 8, 11, 12, 13, 17, 16, 19, 18, 21, 22, 28, 30) AND h.epoch BETWEEN extract(epoch from now() - INTERVAL '1 YEAR')
  9. AND extract(epoch from now()) GROUP BY m.id, h.tier_type) maxEpoch ON maxEpoch.id = m.id
  10. WHERE (h.tier_type=0 AND m.id IN (1, 2, 32, 33, 38, 39, 37, 42, 8, 11, 12, 13, 17, 16, 19, 18, 21, 22, 28, 30) AND h.epoch
  11. BETWEEN extract(epoch from now() - INTERVAL '1 YEAR') AND extract(epoch from now()) AND m.tenant_unit_id=14 AND (interval_mask & 2 > 0)) OR
  12. (maxEpoch.epoch = h.epoch AND maxEpoch.id = m.id AND maxEpoch.tier_type = h.tier_type) ORDER BY h.epoch asc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement