Ниже приведен вывод EXPLAIN запроса с параметром enable_seqscan = true.
Hash Join (cost=1028288.04..278841855100.04 rows=429471108 width=125)
Hash Cond: ((u.destination)::text = (n.mid)::text)
-> Nested Loop (cost=0.00..278587474234.17 rows=429471108 width=112)
Join Filter: (((u.destination)::text <> (u2.mid)::text) AND ("position"((u2.path_name)::text, (suffix(u.path_name))::text) = 0) AND (((prefix((u.path_name)::text))::text = (prefix((u2.path_name)::text))::text) OR ((prefix((u.path_name)::text))::text = 'common'::text)))
-> Seq Scan on unresolved u2 (cost=0.00..2780546.32 rows=117608632 width=79)
-> Index Scan using unresolved__mid on unresolved u (cost=0.00..1864.44 rows=492 width=53)
Index Cond: ((u.mid)::text = (u2.destination)::text)
-> Hash (cost=488335.24..488335.24 rows=27237024 width=33)
-> Seq Scan on name n (cost=0.00..488335.24 rows=27237024 width=33)
(9 строк)
Ниже приведен вывод EXPLAIN того же запроса, но с наборомenable_seqscan = false.
Hash Join (cost=102089128.45..279381508122.13 rows=429471108 width=125)
Hash Cond: ((u.destination)::text = (n.mid)::text)
-> Nested Loop (cost=0.00..279026066415.86 rows=429471108 width=112)
Join Filter: (((u.destination)::text <> (u2.mid)::text) AND ("position"((u2.path_name)::text, (suffix(u.path_name))::text) = 0) AND (((prefix((u.path_name)::text))::text = (prefix((u2.path_name)::text))::text) OR ((prefix((u.path_name)::text))::text = 'common'::text)))
-> Index Scan using unresolved__destination on unresolved u2 (cost=0.00..441372728.01 rows=117608632 width=79)
-> Index Scan using unresolved__mid on unresolved u (cost=0.00..1864.44 rows=492 width=53)
Index Cond: ((u.mid)::text = (u2.destination)::text)
-> Hash (cost=101549175.65..101549175.65 rows=27237024 width=33)
-> Index Scan using name_pkey on name n (cost=0.00..101549175.65 rows=27237024 width=33)
(9 строк)
Я хотел бы знать, сколько времени займет запрос.Он работает уже около 10 часов.Вычисляется ли расчетное время из «стоимости» в первом ряду, в случае последнего это «279381508122,13 мс», что составляет 8,8 года ?!: - (