-- It would be nice if the optimizer could rewrite the query to work like this:
-- (which is very fast)

--explain analyze
select lg.*
    from 	subledg_A	lg
    join	proj_rel	pr	on pr.prog_id = lg.proj
    where	pr.anst_id = 5

union select lg.*
    from 	subledg_B	lg
    join	proj_rel	pr	on pr.prog_id = lg.proj
    where	pr.anst_id = 5

union select lg.*
    from 	subledg_C	lg
    join	proj_rel	pr	on pr.prog_id = lg.proj
    where	pr.anst_id = 5
;
