Open yazun opened 4 years ago
set prefer_olap = false;
brings back a proper plan and execution within ms. Still, this looks like a serious bug, recurrent distributed query where tables are small and driving one is replicated.
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sort (cost=23052.40..23053.49 rows=726 width=136)
Sort Key: r.creationdate DESC
-> GroupAggregate (cost=22978.52..23031.70 rows=726 width=136)
Group Key: r.runid, ((r.state)::text)
-> Sort (cost=22978.52..22980.81 rows=1525 width=277)
Sort Key: r.runid, ((r.state)::text)
-> Hash Left Join (cost=22602.49..22930.14 rows=1525 width=277)
Hash Cond: (rd.runid = r.runid)
-> GroupAggregate (cost=22408.80..22581.65 rows=1525 width=22)
Group Key: rd.status, rd.runid
-> Sort (cost=22408.80..22424.90 rows=10733 width=6)
Sort Key: rd.status, rd.runid
-> Nested Loop (cost=0.07..21977.67 rows=10733 width=6)
-> Remote Subquery Scan on all (datanode1) (cost=100.00..262.84 rows=1 width=4)
-> Seq Scan on run rr (cost=0.00..162.83 rows=1 width=4)
Filter: ((creationdate >= (now() - '1 day'::interval)) AND ((lastupdatedate IS NULL) OR (lastupdatedate >= (now() - '1 day'::interval))))
-> Materialize (cost=100.08..20752.41 rows=25548 width=6)
-> Remote Subquery Scan on all (datanode1,datanode10,datanode11,datanode12,datanode2,datanode3,datanode4,datanode5,datanode6,datanode7,datanode8,datanode9) (cost=100.08..20714.09 rows=25548 width=6)
-> Index Scan using rundataspec_pkey on rundataspec rd (cost=0.07..20537.43 rows=25548 width=6)
Index Cond: (runid = rr.runid)
-> Hash (cost=258.50..258.50 rows=726 width=237)
-> Remote Subquery Scan on all (datanode1) (cost=100.00..258.50 rows=726 width=237)
-> Seq Scan on run r (cost=0.00..156.30 rows=726 width=237)
(23 rows)
Is there a core dump file? If possible, please provide the call stack to locate the problem quickly. Thank you!
The query works well on XL, but on the TBase it crashes the server:
run is replicated, rundataspec is distributed. Statistics are up to date.
and the plan
which finishes with grave error:
on the other hand on XL it returns after few ms, the plan is much simpler: