summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/costsize.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-18 22:44:35 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-18 22:44:35 +0000
commit1ee26b776475155ad1fb00fa3ed0a93659ffadad (patch)
tree1f2c7a59a1fdf3fe3eb62cf5044c5c6c21f77d12 /src/backend/optimizer/path/costsize.c
parent2c0edb3c8677831d836fc44eb58ebecb73f747af (diff)
Reimplement nodeMaterial to use a temporary BufFile (or even memory, if the
materialized tupleset is small enough) instead of a temporary relation. This was something I was thinking of doing anyway for performance, and Jan says he needs it for TOAST because he doesn't want to cope with toasting noname relations. With this change, the 'noname table' support in heap.c is dead code, and I have accordingly removed it. Also clean up 'noname' plan handling in planner --- nonames are either sort or materialize plans, and it seems less confusing to handle them separately under those names.
Diffstat (limited to 'src/backend/optimizer/path/costsize.c')
-rw-r--r--src/backend/optimizer/path/costsize.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index b718f8fea18..0f26dc78722 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.61 2000/05/31 00:28:22 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.62 2000/06/18 22:44:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,10 +55,15 @@
#include "miscadmin.h"
#include "optimizer/clauses.h"
#include "optimizer/cost.h"
-#include "optimizer/internal.h"
#include "utils/lsyscache.h"
+/*
+ * The length of a variable-length field in bytes (stupid estimate...)
+ */
+#define _DEFAULT_ATTRIBUTE_WIDTH_ 12
+
+
#define LOG2(x) (log(x) / 0.693147180559945)
#define LOG6(x) (log(x) / 1.79175946922805)
@@ -114,29 +119,17 @@ cost_seqscan(Path *path, RelOptInfo *baserel)
if (!enable_seqscan)
startup_cost += disable_cost;
- /* disk costs */
- if (lfirsti(baserel->relids) < 0)
- {
-
- /*
- * cost of sequentially scanning a materialized temporary relation
- */
- run_cost += _NONAME_SCAN_COST_;
- }
- else
- {
-
- /*
- * The cost of reading a page sequentially is 1.0, by definition.
- * Note that the Unix kernel will typically do some amount of
- * read-ahead optimization, so that this cost is less than the
- * true cost of reading a page from disk. We ignore that issue
- * here, but must take it into account when estimating the cost of
- * non-sequential accesses!
- */
- run_cost += baserel->pages; /* sequential fetches with cost
- * 1.0 */
- }
+ /*
+ * disk costs
+ *
+ * The cost of reading a page sequentially is 1.0, by definition.
+ * Note that the Unix kernel will typically do some amount of
+ * read-ahead optimization, so that this cost is less than the
+ * true cost of reading a page from disk. We ignore that issue
+ * here, but must take it into account when estimating the cost of
+ * non-sequential accesses!
+ */
+ run_cost += baserel->pages; /* sequential fetches with cost 1.0 */
/* CPU costs */
cpu_per_tuple = cpu_tuple_cost + baserel->baserestrictcost;