users=# explain select * from pxe_tftp_files; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ ---------------- Append (cost=952.58..19605.04 rows=6190 width=124) -> Hash Join (cost=952.58..1199.29 rows=5140 width=124) Hash Cond: (dhcp_nodes.node_id = pxe_nodes.node_id) -> Append (cost=859.80..972.23 rows=2098 width=26) -> Hash Left Join (cost=859.80..938.41 rows=2095 width=26) Hash Cond: (node_links_vw_all.port2_id = ip2.port_id) -> Merge Left Join (cost=810.37..857.55 rows=2095 width=22) Merge Cond: (ipp.port_id = node_links_vw_all.port_id) -> Sort (cost=387.82..389.71 rows=755 width=18) Sort Key: ipp.port_id -> Hash Join (cost=177.29..351.73 rows=755 width=18) Hash Cond: (node_links_vw_all.port_id = ep.port_id) -> Append (cost=0.00..150.04 rows=4492 width=4) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=4) Filter: (date_deleted IS NULL) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=4) Filter: (date_deleted IS NULL) -> Hash (cost=170.02..170.02 rows=582 width=22) -> Hash Join (cost=96.89..170.02 rows=582 width=22) Hash Cond: (ep.node_id = n.node_id) -> Seq Scan on eth_ports ep (cost=0.00..65.61 rows=641 width=8) Filter: (eth_mac IS NOT NULL) -> Hash (cost=84.36..84.36 rows=1003 width=22) -> Hash Join (cost=37.33..84.36 rows=1003 width=22) Hash Cond: (ipp.node_id = n.node_id) -> Seq Scan on ipint_ports ipp (cost=0.00..33.24 rows=1003 width=8) Filter: ((port_name)::text = 'eth0'::text) -> Hash (cost=21.59..21.59 rows=1259 width=14) -> Seq Scan on nodes n (cost=0.00..21.59 rows=1259 width=14) -> Sort (cost=422.55..433.78 rows=4492 width=8) Sort Key: node_links_vw_all.port_id -> Append (cost=0.00..150.04 rows=4492 width=8) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=8) Filter: (date_deleted IS NULL) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=8) Filter: (date_deleted IS NULL) -> Hash (cost=29.19..29.19 rows=1619 width=8) -> Seq Scan on ipint_ports ip2 (cost=0.00..29.19 rows=1619 width=8) -> Subquery Scan "*SELECT* 2" (cost=0.00..12.88 rows=3 width=26) -> Nested Loop Left Join (cost=0.00..12.85 rows=3 width=26) -> Nested Loop Left Join (cost=0.00..11.93 rows=3 width=22) Join Filter: (node_links_vw_all.port_id = ipp.port_id) -> Nested Loop (cost=0.00..11.14 rows=1 width=18) Join Filter: (node_links_vw_all.port_id = ep.port_id) -> Nested Loop (cost=0.00..10.02 rows=1 width=22) -> Nested Loop (cost=0.00..9.61 rows=1 width=26) -> Nested Loop (cost=0.00..9.29 rows=1 width=12) -> Seq Scan on vm_nodes vm (cost=0.00..1.01 rows=1 width=8) -> Index Scan using ipint_ports_pkey on ipint_ports ipp (cost=0.00..8.27 rows=1 width=8) Index Cond: (vm.port_id = ipp.port_id) -> Index Scan using nodes_pkey on nodes n (cost=0.00..0.30 rows=1 width=14) Index Cond: (n.node_id = ipp.node_id) -> Index Scan using eth_ports_nodeid on eth_ports ep (cost=0.00..0.40 rows=1 width=8) Index Cond: (ep.node_id = n.node_id) Filter: (eth_mac IS NOT NULL) -> Append (cost=0.00..1.09 rows=2 width=4) -> Index Scan using node_links2_idx1 on node_links2 n1 (cost=0.00..0.54 rows=1 width= 4) Index Cond: (n1.port_id = ep.port_id) Filter: (date_deleted IS NULL) -> Index Scan using node_links2_idx2 on node_links2 n1 (cost=0.00..0.55 rows=1 width= 4) Index Cond: (n1.port2_id = ep.port_id) Filter: (date_deleted IS NULL) -> Append (cost=0.00..0.77 rows=2 width=8) -> Index Scan using node_links2_idx1 on node_links2 n1 (cost=0.00..0.37 rows=1 width=8) Index Cond: (n1.port_id = ipp.port_id) Filter: (date_deleted IS NULL) -> Index Scan using node_links2_idx2 on node_links2 n1 (cost=0.00..0.39 rows=1 width=8) Index Cond: (n1.port2_id = ipp.port_id) Filter: (date_deleted IS NULL) -> Index Scan using ipint_ports_pkey on ipint_ports ip2 (cost=0.00..0.28 rows=1 width=8) Index Cond: (ip2.port_id = node_links_vw_all.port2_id) -> Hash (cost=78.09..78.09 rows=1176 width=92) -> Hash Join (cost=20.80..78.09 rows=1176 width=92) Hash Cond: (pxe_prog.prog_id = pxe_nodes.prog_id) -> Seq Scan on pxe_prog (cost=0.00..14.90 rows=490 width=92) -> Hash (cost=14.80..14.80 rows=480 width=8) -> Seq Scan on pxe_nodes (cost=0.00..14.80 rows=480 width=8) -> Subquery Scan dn (cost=859.80..18343.84 rows=1049 width=36) Filter: (NOT (subplan)) -> Append (cost=859.80..972.23 rows=2098 width=26) -> Hash Left Join (cost=859.80..938.41 rows=2095 width=26) Hash Cond: (node_links_vw_all.port2_id = ip2.port_id) -> Merge Left Join (cost=810.37..857.55 rows=2095 width=22) Merge Cond: (ipp.port_id = node_links_vw_all.port_id) -> Sort (cost=387.82..389.71 rows=755 width=18) Sort Key: ipp.port_id -> Hash Join (cost=177.29..351.73 rows=755 width=18) Hash Cond: (node_links_vw_all.port_id = ep.port_id) -> Append (cost=0.00..150.04 rows=4492 width=4) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=4) Filter: (date_deleted IS NULL) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=4) Filter: (date_deleted IS NULL) -> Hash (cost=170.02..170.02 rows=582 width=22) -> Hash Join (cost=96.89..170.02 rows=582 width=22) Hash Cond: (ep.node_id = n.node_id) -> Seq Scan on eth_ports ep (cost=0.00..65.61 rows=641 width=8) Filter: (eth_mac IS NOT NULL) -> Hash (cost=84.36..84.36 rows=1003 width=22) -> Hash Join (cost=37.33..84.36 rows=1003 width=22) Hash Cond: (ipp.node_id = n.node_id) -> Seq Scan on ipint_ports ipp (cost=0.00..33.24 rows=1003 width=8) Filter: ((port_name)::text = 'eth0'::text) -> Hash (cost=21.59..21.59 rows=1259 width=14) -> Seq Scan on nodes n (cost=0.00..21.59 rows=1259 width=14) -> Sort (cost=422.55..433.78 rows=4492 width=8) Sort Key: node_links_vw_all.port_id -> Append (cost=0.00..150.04 rows=4492 width=8) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=8) Filter: (date_deleted IS NULL) -> Seq Scan on node_links2 n1 (cost=0.00..75.02 rows=2246 width=8) Filter: (date_deleted IS NULL) -> Hash (cost=29.19..29.19 rows=1619 width=8) -> Seq Scan on ipint_ports ip2 (cost=0.00..29.19 rows=1619 width=8) -> Subquery Scan "*SELECT* 2" (cost=0.00..12.88 rows=3 width=26) -> Nested Loop Left Join (cost=0.00..12.85 rows=3 width=26) -> Nested Loop Left Join (cost=0.00..11.93 rows=3 width=22) Join Filter: (node_links_vw_all.port_id = ipp.port_id) -> Nested Loop (cost=0.00..11.14 rows=1 width=18) Join Filter: (node_links_vw_all.port_id = ep.port_id) -> Nested Loop (cost=0.00..10.02 rows=1 width=22) -> Nested Loop (cost=0.00..9.61 rows=1 width=26) -> Nested Loop (cost=0.00..9.29 rows=1 width=12) -> Seq Scan on vm_nodes vm (cost=0.00..1.01 rows=1 width=8) -> Index Scan using ipint_ports_pkey on ipint_ports ipp (cost=0.00..8.27 rows=1 width=8) Index Cond: (vm.port_id = ipp.port_id) -> Index Scan using nodes_pkey on nodes n (cost=0.00..0.30 rows=1 width=14) Index Cond: (n.node_id = ipp.node_id) -> Index Scan using eth_ports_nodeid on eth_ports ep (cost=0.00..0.40 rows=1 width=8) Index Cond: (ep.node_id = n.node_id) Filter: (eth_mac IS NOT NULL) -> Append (cost=0.00..1.09 rows=2 width=4) -> Index Scan using node_links2_idx1 on node_links2 n1 (cost=0.00..0.54 rows=1 width= 4) Index Cond: (n1.port_id = ep.port_id) Filter: (date_deleted IS NULL) -> Index Scan using node_links2_idx2 on node_links2 n1 (cost=0.00..0.55 rows=1 width= 4) Index Cond: (n1.port2_id = ep.port_id) Filter: (date_deleted IS NULL) -> Append (cost=0.00..0.77 rows=2 width=8) -> Index Scan using node_links2_idx1 on node_links2 n1 (cost=0.00..0.37 rows=1 width=8) Index Cond: (n1.port_id = ipp.port_id) Filter: (date_deleted IS NULL) -> Index Scan using node_links2_idx2 on node_links2 n1 (cost=0.00..0.39 rows=1 width=8) Index Cond: (n1.port2_id = ipp.port_id) Filter: (date_deleted IS NULL) -> Index Scan using ipint_ports_pkey on ipint_ports ip2 (cost=0.00..0.28 rows=1 width=8) Index Cond: (ip2.port_id = node_links_vw_all.port2_id) SubPlan -> Index Scan using pxe_nodes_pkey on pxe_nodes pe (cost=0.00..8.27 rows=1 width=133) Index Cond: (node_id = $0) -> Subquery Scan "*SELECT* 3" (cost=0.00..0.02 rows=1 width=0) -> Result (cost=0.00..0.01 rows=1 width=0)