you can use Explain to show how the query optimizer will handle your query.
http://www.postgresql.org/docs/9.2/static/sql-explain.html
In the case above PSQL should see that temp3 is not used and not include it.
using your example above on one my dbs.
explain with temp1 as (select * from cidrs), temp2 as (select * from contacts), temp3 as ( select * from accounts ) select * from temp1 join temp2 on temp1.id = temp2.id;
QUERY PLAN
---------------------------------------------------------------------
Hash Join (cost=22.15..25.44 rows=20 width=4174)
Hash Cond: (temp1.id = temp2.id)
CTE temp1
-> Seq Scan on cidrs (cost=0.00..11.30 rows=130 width=588)
CTE temp2
-> Seq Scan on contacts (cost=0.00..10.20 rows=20 width=3586)
-> CTE Scan on temp1 (cost=0.00..2.60 rows=130 width=588)
-> Hash (cost=0.40..0.40 rows=20 width=3586)
-> CTE Scan on temp2 (cost=0.00..0.40 rows=20 width=3586)
(9 rows)
you will notice no mention of temp3. In answering your edit, about why it doesn't affect query time, the optimizer is smart enough to see that it isn't used and doesn't bother computing it. Hence the reason it is an optimizer.