pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid some zero-divide hazards in the planner. 7+ messages / 1 participants [nested] [flat]
* pgsql: Avoid some zero-divide hazards in the planner. @ 2015-07-30 16:11 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-07-30 16:11 UTC (permalink / raw) To: pgsql-committers Avoid some zero-divide hazards in the planner. Although I think on all modern machines floating division by zero results in Infinity not SIGFPE, we still don't want infinities running around in the planner's costing estimates; too much risk of that leading to insane behavior. grouping_planner() failed to consider the possibility that final_rel might be known dummy and hence have zero rowcount. (I wonder if it would be better to set a rows estimate of 1 for dummy relations? But at least in the back branches, changing this convention seems like a bad idea, so I'll leave that for another day.) Make certain that get_variable_numdistinct() produces a nonzero result. The case that can be shown to be broken is with stadistinct < 0.0 and small ntuples; we did not prevent the result from rounding to zero. For good luck I applied clamp_row_est() to all the nonconstant return values. In ExecChooseHashTableSize(), Assert that we compute positive nbuckets and nbatch. I know of no reason to think this isn't the case, but it seems like a good safety check. Per reports from Piotr Stefaniak. Back-patch to all active branches. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/3b4a9dbfa5339405f7f78639b83bfb563603cfe3 Modified Files -------------- src/backend/executor/nodeHash.c | 3 +++ src/backend/optimizer/plan/planner.c | 6 ++++-- src/backend/utils/adt/selfuncs.c | 10 +++++----- 3 files changed, 12 insertions(+), 7 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid some zero-divide hazards in the planner. @ 2015-07-30 16:11 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-07-30 16:11 UTC (permalink / raw) To: pgsql-committers Avoid some zero-divide hazards in the planner. Although I think on all modern machines floating division by zero results in Infinity not SIGFPE, we still don't want infinities running around in the planner's costing estimates; too much risk of that leading to insane behavior. grouping_planner() failed to consider the possibility that final_rel might be known dummy and hence have zero rowcount. (I wonder if it would be better to set a rows estimate of 1 for dummy relations? But at least in the back branches, changing this convention seems like a bad idea, so I'll leave that for another day.) Make certain that get_variable_numdistinct() produces a nonzero result. The case that can be shown to be broken is with stadistinct < 0.0 and small ntuples; we did not prevent the result from rounding to zero. For good luck I applied clamp_row_est() to all the nonconstant return values. In ExecChooseHashTableSize(), Assert that we compute positive nbuckets and nbatch. I know of no reason to think this isn't the case, but it seems like a good safety check. Per reports from Piotr Stefaniak. Back-patch to all active branches. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/caae9f764699e44e2e95394b90f48d4429b8ea3f Modified Files -------------- src/backend/executor/nodeHash.c | 3 +++ src/backend/optimizer/plan/planmain.c | 2 +- src/backend/optimizer/plan/planner.c | 7 +++++-- src/backend/utils/adt/selfuncs.c | 10 +++++----- 4 files changed, 14 insertions(+), 8 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid some zero-divide hazards in the planner. @ 2015-07-30 16:11 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-07-30 16:11 UTC (permalink / raw) To: pgsql-committers Avoid some zero-divide hazards in the planner. Although I think on all modern machines floating division by zero results in Infinity not SIGFPE, we still don't want infinities running around in the planner's costing estimates; too much risk of that leading to insane behavior. grouping_planner() failed to consider the possibility that final_rel might be known dummy and hence have zero rowcount. (I wonder if it would be better to set a rows estimate of 1 for dummy relations? But at least in the back branches, changing this convention seems like a bad idea, so I'll leave that for another day.) Make certain that get_variable_numdistinct() produces a nonzero result. The case that can be shown to be broken is with stadistinct < 0.0 and small ntuples; we did not prevent the result from rounding to zero. For good luck I applied clamp_row_est() to all the nonconstant return values. In ExecChooseHashTableSize(), Assert that we compute positive nbuckets and nbatch. I know of no reason to think this isn't the case, but it seems like a good safety check. Per reports from Piotr Stefaniak. Back-patch to all active branches. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/8693ebe37d65ec1bc1ebeab36f60b38f18fb25d6 Modified Files -------------- src/backend/executor/nodeHash.c | 3 +++ src/backend/optimizer/plan/planner.c | 6 ++++-- src/backend/utils/adt/selfuncs.c | 10 +++++----- 3 files changed, 12 insertions(+), 7 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid some zero-divide hazards in the planner. @ 2015-07-30 16:11 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-07-30 16:11 UTC (permalink / raw) To: pgsql-committers Avoid some zero-divide hazards in the planner. Although I think on all modern machines floating division by zero results in Infinity not SIGFPE, we still don't want infinities running around in the planner's costing estimates; too much risk of that leading to insane behavior. grouping_planner() failed to consider the possibility that final_rel might be known dummy and hence have zero rowcount. (I wonder if it would be better to set a rows estimate of 1 for dummy relations? But at least in the back branches, changing this convention seems like a bad idea, so I'll leave that for another day.) Make certain that get_variable_numdistinct() produces a nonzero result. The case that can be shown to be broken is with stadistinct < 0.0 and small ntuples; we did not prevent the result from rounding to zero. For good luck I applied clamp_row_est() to all the nonconstant return values. In ExecChooseHashTableSize(), Assert that we compute positive nbuckets and nbatch. I know of no reason to think this isn't the case, but it seems like a good safety check. Per reports from Piotr Stefaniak. Back-patch to all active branches. Branch ------ REL9_0_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/54833c5e772ee0e8461269e1b40ab6b9fae4b1cd Modified Files -------------- src/backend/executor/nodeHash.c | 3 +++ src/backend/optimizer/plan/planmain.c | 2 +- src/backend/optimizer/plan/planner.c | 7 +++++-- src/backend/utils/adt/selfuncs.c | 10 +++++----- 4 files changed, 14 insertions(+), 8 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid some zero-divide hazards in the planner. @ 2015-07-30 16:11 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-07-30 16:11 UTC (permalink / raw) To: pgsql-committers Avoid some zero-divide hazards in the planner. Although I think on all modern machines floating division by zero results in Infinity not SIGFPE, we still don't want infinities running around in the planner's costing estimates; too much risk of that leading to insane behavior. grouping_planner() failed to consider the possibility that final_rel might be known dummy and hence have zero rowcount. (I wonder if it would be better to set a rows estimate of 1 for dummy relations? But at least in the back branches, changing this convention seems like a bad idea, so I'll leave that for another day.) Make certain that get_variable_numdistinct() produces a nonzero result. The case that can be shown to be broken is with stadistinct < 0.0 and small ntuples; we did not prevent the result from rounding to zero. For good luck I applied clamp_row_est() to all the nonconstant return values. In ExecChooseHashTableSize(), Assert that we compute positive nbuckets and nbatch. I know of no reason to think this isn't the case, but it seems like a good safety check. Per reports from Piotr Stefaniak. Back-patch to all active branches. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/e91a1643ac723477d6ec2d47c8486cd0013660bb Modified Files -------------- src/backend/executor/nodeHash.c | 3 +++ src/backend/optimizer/plan/planner.c | 6 ++++-- src/backend/utils/adt/selfuncs.c | 10 +++++----- 3 files changed, 12 insertions(+), 7 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid some zero-divide hazards in the planner. @ 2015-07-30 16:11 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-07-30 16:11 UTC (permalink / raw) To: pgsql-committers Avoid some zero-divide hazards in the planner. Although I think on all modern machines floating division by zero results in Infinity not SIGFPE, we still don't want infinities running around in the planner's costing estimates; too much risk of that leading to insane behavior. grouping_planner() failed to consider the possibility that final_rel might be known dummy and hence have zero rowcount. (I wonder if it would be better to set a rows estimate of 1 for dummy relations? But at least in the back branches, changing this convention seems like a bad idea, so I'll leave that for another day.) Make certain that get_variable_numdistinct() produces a nonzero result. The case that can be shown to be broken is with stadistinct < 0.0 and small ntuples; we did not prevent the result from rounding to zero. For good luck I applied clamp_row_est() to all the nonconstant return values. In ExecChooseHashTableSize(), Assert that we compute positive nbuckets and nbatch. I know of no reason to think this isn't the case, but it seems like a good safety check. Per reports from Piotr Stefaniak. Back-patch to all active branches. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/ea6e286491210e4ec2ddd542faccfe9227eb890f Modified Files -------------- src/backend/executor/nodeHash.c | 3 +++ src/backend/optimizer/plan/planmain.c | 2 +- src/backend/optimizer/plan/planner.c | 7 +++++-- src/backend/utils/adt/selfuncs.c | 10 +++++----- 4 files changed, 14 insertions(+), 8 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid some zero-divide hazards in the planner. @ 2015-07-30 16:11 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-07-30 16:11 UTC (permalink / raw) To: pgsql-committers Avoid some zero-divide hazards in the planner. Although I think on all modern machines floating division by zero results in Infinity not SIGFPE, we still don't want infinities running around in the planner's costing estimates; too much risk of that leading to insane behavior. grouping_planner() failed to consider the possibility that final_rel might be known dummy and hence have zero rowcount. (I wonder if it would be better to set a rows estimate of 1 for dummy relations? But at least in the back branches, changing this convention seems like a bad idea, so I'll leave that for another day.) Make certain that get_variable_numdistinct() produces a nonzero result. The case that can be shown to be broken is with stadistinct < 0.0 and small ntuples; we did not prevent the result from rounding to zero. For good luck I applied clamp_row_est() to all the nonconstant return values. In ExecChooseHashTableSize(), Assert that we compute positive nbuckets and nbatch. I know of no reason to think this isn't the case, but it seems like a good safety check. Per reports from Piotr Stefaniak. Back-patch to all active branches. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/c7d1712519085b46b084412631ab3a0c27a7a1a6 Modified Files -------------- src/backend/executor/nodeHash.c | 3 +++ src/backend/optimizer/plan/planmain.c | 2 +- src/backend/optimizer/plan/planner.c | 7 +++++-- src/backend/utils/adt/selfuncs.c | 10 +++++----- 4 files changed, 14 insertions(+), 8 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2015-07-30 16:11 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-07-30 16:11 pgsql: Avoid some zero-divide hazards in the planner. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-30 16:11 pgsql: Avoid some zero-divide hazards in the planner. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-30 16:11 pgsql: Avoid some zero-divide hazards in the planner. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-30 16:11 pgsql: Avoid some zero-divide hazards in the planner. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-30 16:11 pgsql: Avoid some zero-divide hazards in the planner. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-30 16:11 pgsql: Avoid some zero-divide hazards in the planner. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-30 16:11 pgsql: Avoid some zero-divide hazards in the planner. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox