问题
My postgres-xl version was 9.5r1.5 stable. When query like below
SELECT * FROM tests t1 LEFT JOIN tests t2 ON t1.id1 = t2.id2 WHERE t1.id1=10000;
This query is simple, and just return one row. When I ran it in the data node, only cost 10ms. But cost 10020 ms in the coord node. I had tried some other query, and make sure that, when join the same table coord node cost 10 seconds. But if the query return nothing, it only cost 20ms in the coord node. So i think, it something wrong when coord node combine the data. can anyone tell me how to avoid this. thanks very much.
回答1:
Also try something like "SET work_mem = '256MB'; SET LOCAL work_mem = '256MB';". Increase default memory for sorting and vacuum.
回答2:
This is more a question for https://dba.stackexchange.com and, in fact, someone had the same problem there.
You can see my answer on the linked question, here is a short summary:
It's a postgres-xl bug that is triggered on queries planned and executed using rows redistribution and for which some nodes don't have any rows.
You can work around it by changing the query, chaning the tables distribution, or adding data. You can use
EXPLAIN
to check if your query will involve data redistribution.
来源:https://stackoverflow.com/questions/44015331/postgres-xl-self-join-cost-10-seconds-when-combine-data