pg_hint_plan icon indicating copy to clipboard operation
pg_hint_plan copied to clipboard

parallel and indexscan must be used together for parallel index scan

Open STakahiro opened this issue 5 years ago • 3 comments

it seems Parallel() must be given with IndexScan() to let PostgreSQL use parallel index scan. not sure if it's true though feel it's right by reading the source code and if actually it is so then it should be on the manual or somewhere obvious.

version: pg10, 1.3.*

ex. /*+ IndexScan(tb idx_tb) */

  • when the planner chose to use parallel query, just giving IndexScan() hint doesn't make it use index scan
  • if the planner doesn't chose to use parallel, there is no problem. it uses index scan.

/*+ Parallel(tb 2 hard) IndexScan(tb idx_tb) */

  • giving Parallel() hint together make it actually use index scan
  • OR should give Parallel(tb 0 hard) to make sure it accidentally chose parallel and uses seq scan.

STakahiro avatar Jan 24 '20 08:01 STakahiro

There was a bug that indexpats are not recreated without parallel hints. The following commit will fix that. Please could you check it?

https://github.com/ossc-db/pg_hint_plan/commit/26d0decb8dbb4b75595baafcaca6cab48c0da1c0

horiguti avatar Feb 17 '20 05:02 horiguti

I and STakahiro confirmed the patch fixes the problem. Thanks. (And, sorry for late feedback)

harukat avatar Mar 10 '20 01:03 harukat

Note for future readers, afaict this fix was released in 1.3.5

ddrobt avatar Mar 25 '21 04:03 ddrobt