История изменений
Исправление AlexKiriukha, (текущая версия) :
explain SELECT
product_name,
type_name
FROM
products p,
product_types pt
WHERE
p.type_id = pt.id;
QUERY PLAN
---------------------------------------------------------------------------------
Hash Join (cost=38.58..63.74 rows=1200 width=64)
Hash Cond: (p.type_id = pt.id)
-> Seq Scan on products p (cost=0.00..22.00 rows=1200 width=36)
-> Hash (cost=22.70..22.70 rows=1270 width=36)
-> Seq Scan on product_types pt (cost=0.00..22.70 rows=1270 width=36)
(5 rows)
=# explain
SELECT
product_name,
type_name
FROM
products p
JOIN product_types pt ON p.type_id = pt.id;
QUERY PLAN
---------------------------------------------------------------------------------
Hash Join (cost=38.58..63.74 rows=1200 width=64)
Hash Cond: (p.type_id = pt.id)
-> Seq Scan on products p (cost=0.00..22.00 rows=1200 width=36)
-> Hash (cost=22.70..22.70 rows=1270 width=36)
-> Seq Scan on product_types pt (cost=0.00..22.70 rows=1270 width=36)
не нашел отличий в планах.
Исправление AlexKiriukha, :
explain SELECT
product_name,
type_name
FROM
products p,
product_types pt
WHERE
p.type_id = pt.id;
QUERY PLAN
---------------------------------------------------------------------------------
Hash Join (cost=38.58..63.74 rows=1200 width=64)
Hash Cond: (p.type_id = pt.id)
-> Seq Scan on products p (cost=0.00..22.00 rows=1200 width=36)
-> Hash (cost=22.70..22.70 rows=1270 width=36)
-> Seq Scan on product_types pt (cost=0.00..22.70 rows=1270 width=36)
(5 rows)
=# explain
SELECT
product_name,
type_name
FROM
products p
JOIN product_types pt ON p.type_id = pt.id;
QUERY PLAN
---------------------------------------------------------------------------------
Hash Join (cost=38.58..63.74 rows=1200 width=64)
Hash Cond: (p.type_id = pt.id)
-> Seq Scan on products p (cost=0.00..22.00 rows=1200 width=36)
-> Hash (cost=22.70..22.70 rows=1270 width=36)
-> Seq Scan on product_types pt (cost=0.00..22.70 rows=1270 width=36)
Исходная версия AlexKiriukha, :
explain SELECT
product_name,
type_name
FROM
products p,
product_types pt
WHERE
p.type_id = pt.id;
QUERY PLAN
Hash Join (cost=38.58..63.74 rows=1200 width=64) Hash Cond: (p.type_id = pt.id) -> Seq Scan on products p (cost=0.00..22.00 rows=1200 width=36) -> Hash (cost=22.70..22.70 rows=1270 width=36) -> Seq Scan on product_types pt (cost=0.00..22.70 rows=1270 width=36) (5 rows)
=# explain SELECT product_name, type_name FROM products p JOIN product_types pt ON p.type_id = pt.id; QUERY PLAN
Hash Join (cost=38.58..63.74 rows=1200 width=64) Hash Cond: (p.type_id = pt.id) -> Seq Scan on products p (cost=0.00..22.00 rows=1200 width=36) -> Hash (cost=22.70..22.70 rows=1270 width=36) -> Seq Scan on product_types pt (cost=0.00..22.70 rows=1270 width=36)