mirror of
https://github.com/postgres/postgres.git
synced 2025-05-12 16:21:30 +03:00
Avoid overflow in cost_sort when work_mem exceeds 1Gb.
This commit is contained in:
parent
6e3cc2029d
commit
529db99c6e
@ -49,7 +49,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.134 2004/08/29 05:06:43 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.135 2004/10/23 00:05:27 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -566,7 +566,7 @@ cost_sort(Path *path, Query *root,
|
|||||||
if (nbytes > work_mem_bytes)
|
if (nbytes > work_mem_bytes)
|
||||||
{
|
{
|
||||||
double npages = ceil(nbytes / BLCKSZ);
|
double npages = ceil(nbytes / BLCKSZ);
|
||||||
double nruns = nbytes / (work_mem_bytes * 2);
|
double nruns = (nbytes / work_mem_bytes) * 0.5;
|
||||||
double log_runs = ceil(LOG6(nruns));
|
double log_runs = ceil(LOG6(nruns));
|
||||||
double npageaccesses;
|
double npageaccesses;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user