Skip to content

Commit 79bc99a

Browse files
committed
Convert effective_cache_size to an integer, for better integration with
upcoming units feature.
1 parent 0c57c83 commit 79bc99a

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

doc/src/sgml/config.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.69 2006/07/25 03:51:21 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.70 2006/07/26 11:35:55 petere Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -1856,7 +1856,7 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
18561856
</varlistentry>
18571857

18581858
<varlistentry id="guc-effective-cache-size" xreflabel="effective_cache_size">
1859-
<term><varname>effective_cache_size</varname> (<type>floating point</type>)</term>
1859+
<term><varname>effective_cache_size</varname> (<type>integer</type>)</term>
18601860
<indexterm>
18611861
<primary><varname>effective_cache_size</> configuration parameter</primary>
18621862
</indexterm>

src/backend/optimizer/path/costsize.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* Portions Copyright (c) 1994, Regents of the University of California
5555
*
5656
* IDENTIFICATION
57-
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.163 2006/07/22 15:41:55 tgl Exp $
57+
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.164 2006/07/26 11:35:56 petere Exp $
5858
*
5959
*-------------------------------------------------------------------------
6060
*/
@@ -92,7 +92,7 @@ double cpu_tuple_cost = DEFAULT_CPU_TUPLE_COST;
9292
double cpu_index_tuple_cost = DEFAULT_CPU_INDEX_TUPLE_COST;
9393
double cpu_operator_cost = DEFAULT_CPU_OPERATOR_COST;
9494

95-
double effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE;
95+
int effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE;
9696

9797
Cost disable_cost = 100000000.0;
9898

@@ -393,7 +393,7 @@ index_pages_fetched(double tuples_fetched, BlockNumber pages,
393393
T = (pages > 1) ? (double) pages : 1.0;
394394

395395
/* b is pro-rated share of effective_cache_size */
396-
b = effective_cache_size * T / (T + (double) other_pages);
396+
b = (double) effective_cache_size * T / (T + (double) other_pages);
397397
/* force it positive and integral */
398398
if (b <= 1.0)
399399
b = 1.0;

src/backend/utils/misc/guc.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.329 2006/07/25 03:51:21 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.330 2006/07/26 11:35:56 petere Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -1579,6 +1579,17 @@ static struct config_int ConfigureNamesInt[] =
15791579
0, 0, INT_MAX, NULL, NULL
15801580
},
15811581

1582+
{
1583+
{"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
1584+
gettext_noop("Sets the planner's assumption about size of the disk cache."),
1585+
gettext_noop("That is, the portion of the kernel's disk cache that "
1586+
"will be used for PostgreSQL data files. This is measured in disk "
1587+
"pages, which are normally 8 kB each.")
1588+
},
1589+
&effective_cache_size,
1590+
DEFAULT_EFFECTIVE_CACHE_SIZE, 1, INT_MAX, NULL, NULL
1591+
},
1592+
15821593
/* End-of-list marker */
15831594
{
15841595
{NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL
@@ -1634,17 +1645,6 @@ static struct config_real ConfigureNamesReal[] =
16341645
DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX, NULL, NULL
16351646
},
16361647

1637-
{
1638-
{"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
1639-
gettext_noop("Sets the planner's assumption about size of the disk cache."),
1640-
gettext_noop("That is, the portion of the kernel's disk cache that "
1641-
"will be used for PostgreSQL data files. This is measured in disk "
1642-
"pages, which are normally 8 kB each.")
1643-
},
1644-
&effective_cache_size,
1645-
DEFAULT_EFFECTIVE_CACHE_SIZE, 1, DBL_MAX, NULL, NULL
1646-
},
1647-
16481648
{
16491649
{"geqo_selection_bias", PGC_USERSET, QUERY_TUNING_GEQO,
16501650
gettext_noop("GEQO: selective pressure within the population."),

src/include/optimizer/cost.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.77 2006/07/22 15:41:56 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.78 2006/07/26 11:35:56 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -27,7 +27,7 @@
2727
#define DEFAULT_CPU_INDEX_TUPLE_COST 0.005
2828
#define DEFAULT_CPU_OPERATOR_COST 0.0025
2929

30-
#define DEFAULT_EFFECTIVE_CACHE_SIZE 1000.0 /* measured in pages */
30+
#define DEFAULT_EFFECTIVE_CACHE_SIZE 1000 /* measured in pages */
3131

3232

3333
/*
@@ -41,7 +41,7 @@ extern DLLIMPORT double random_page_cost;
4141
extern DLLIMPORT double cpu_tuple_cost;
4242
extern DLLIMPORT double cpu_index_tuple_cost;
4343
extern DLLIMPORT double cpu_operator_cost;
44-
extern DLLIMPORT double effective_cache_size;
44+
extern DLLIMPORT int effective_cache_size;
4545
extern Cost disable_cost;
4646
extern bool enable_seqscan;
4747
extern bool enable_indexscan;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy