How much are those volumes in the library? (redone)

I have an improvement on the original query. This one outputs ‘nil’ if the volume is empty.

bacula=# 
  SELECT mediaid, volumename, volstatus, slot, inchanger, pool.name,
             CASE WHEN volbytes < = 64512 THEN 'nil' else pg_size_pretty(volbytes) END
    FROM media, pool
   WHERE media.poolid = pool.poolid
     AND volumename LIKE 'ETU0%'
     AND inchanger != 0
ORDER BY slot;
 mediaid | volumename | volstatus | slot | inchanger |     name      | pg_size_pretty
---------+------------+-----------+------+-----------+---------------+----------------
    1328 | ETU021     | Append    |    1 |         1 | Differentials | nil
    1316 | ETU020     | Append    |    2 |         1 | Differentials | 10 GB
    1463 | ETU034     | Append    |    3 |         1 | Incrementals  | 24 GB
    1464 | ETU035     | Append    |    4 |         1 | Incrementals  | nil
    1286 | ETU002     | Append    |    5 |         1 | Fulls         | nil
    1284 | ETU004     | Append    |    6 |         1 | Fulls         | 27 GB
    1285 | ETU003     | Append    |    7 |         1 | Fulls         | nil
    1465 | ETU030     | Append    |    8 |         1 | Incrementals  | nil
    1466 | ETU036     | Append    |    9 |         1 | Incrementals  | nil
    1467 | ETU037     | Append    |   10 |         1 | Incrementals  | nil
(10 rows)

bacula=#
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top