0

I have a table tbl_a with 200 k records. I wrote a query to bring sum of id (int) column. Now execution plans shows 2 workers launched and below that parallel sequential scan on tbl_a is shown 3 times; with processing 66667 records each time(200k/3=66667). Now my question is since there were two workers so should there not be only two times table seq scan and each time with record 100k (200k/3). I am attaching the image which lists the table detail, query and query execution plan for better understanding. enter image description here

Can someone tell me why with 2 workers there are 3 loops , each processing 6667 records out of total 200k records?

  • Please edit your question and add the execution plan as formatted text (the screen shot is barely readable) and make sure you prevent the indention of the plan. Copy the text from the console then paste it into your question and put ``` on the line before the plan and on a line after the plan. – a_horse_with_no_name Apr 16 at 8:32
2

The two worker processes are additional to the session backend process, which is the “parallel leader”, so there are three processes working on the scan.

| improve this answer | |
  • Thanks a lot @Laurenz Albe. it was very helpful. Laurenz I was doing streaming replication and was getting errors on pg_hba.conf. Could you please look and help on question dba.stackexchange.com/questions/265853/…. It would really help. – user3143770 Apr 26 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.