<div dir="ltr">I just want to open up this topic and hopefully gather some knowledge... I am trying to figure how we can get a little more support from parallelism in our queries, and where we can hint the planner to do better things for us since we are so frequently CPU bound.<div><br></div><div>The costs in <a href="http://postgis.sql.in">postgis.sql.in</a> seem to be hand set function by function, which makes it hard to change things globally (make everything twice as costly?) so the first thing I thought was, make them all macros substitutions, like this</div><div><br></div><div><div>/*</div><div> * Group cost macros to make tuning the whole thing at once</div><div> * easier in theory.</div><div> */</div><div>#define _COST_C_LOW     COST 5</div><div>#define _COST_C_MED     COST 100</div><div>#define _COST_C_HIGH    COST 1000</div><div>#define _COST_GEOS_LOW  COST 100</div><div>#define _COST_GEOS_MED  COST 1000</div><div>#define _COST_GEOS_HIGH COST 10000</div><div>#define _COST_PL_LOW    COST 100</div><div>#define _COST_PL_MED    COST 1000</div><div>#define _COST_PL_HIGH   COST 10000</div></div><div><br></div><div><br></div><div>However, when starting to put them into place I came across both</div><div><br></div><div>- old commentary indicating some much finer cost discrimination based on Paul Norman's work</div><div>- newer commentary indicating costs breaking good query execution of some of our inlined functions (ST_Intersects())</div><div><br></div><div>On the latter issue, it sounds like slight changes in how we define our inline functions could help. I'd love to test if this works but... I cannot reproduce the original issue. <a href="http://trac.osgeo.org/postgis/ticket/3675">http://trac.osgeo.org/postgis/ticket/3675</a> So I cannot test if the "fix" fixes things. Does anyone else see this issue still? Is it perhaps a PgSQL 9.6 online thing?</div><div><br></div><div>On the former issue, I'm not sure how much we trust the empirical cost scoring? More importantly, if we can force parallelism by increasing our costs, even beyond the empirical values, do we want to do that?</div><div><br></div><div>Any other knowledge of parallelism or costing folks have and can link to or share, would love to hear!<br><br>P</div></div>