diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-09 00:26:47 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-09 00:26:47 +0000 |
commit | 166b5c1def56a8c43536ac64bd0ba92517f67765 (patch) | |
tree | 09a047af2ae3b27e0c071a2fd1fbd32785a66190 /src/backend/nodes/readfuncs.c | |
parent | 69d4299e3e534686274480ba245566914932c017 (diff) | |
download | postgresql-166b5c1def56a8c43536ac64bd0ba92517f67765.tar.gz postgresql-166b5c1def56a8c43536ac64bd0ba92517f67765.zip |
Another round of planner/optimizer work. This is just restructuring and
code cleanup; no major improvements yet. However, EXPLAIN does produce
more intuitive outputs for nested loops with indexscans now...
Diffstat (limited to 'src/backend/nodes/readfuncs.c')
-rw-r--r-- | src/backend/nodes/readfuncs.c | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 83683ff3b10..8f7bb5271ac 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.76 1999/12/13 01:26:54 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.77 2000/01/09 00:26:24 tgl Exp $ * * NOTES * Most of the read functions for plan nodes are tested. (In fact, they @@ -233,9 +233,9 @@ _getPlan(Plan *node) token = lsptok(NULL, &length); /* next is the actual cost */ node->cost = (Cost) atof(token); - token = lsptok(NULL, &length); /* skip the :size */ - token = lsptok(NULL, &length); /* get the plan_size */ - node->plan_size = atoi(token); + token = lsptok(NULL, &length); /* skip the :rows */ + token = lsptok(NULL, &length); /* get the plan_rows */ + node->plan_rows = atof(token); token = lsptok(NULL, &length); /* skip the :width */ token = lsptok(NULL, &length); /* get the plan_width */ @@ -1293,6 +1293,14 @@ _readRelOptInfo() token = lsptok(NULL, &length); /* get :relids */ local_node->relids = toIntList(nodeRead(true)); /* now read it */ + token = lsptok(NULL, &length); /* get :rows */ + token = lsptok(NULL, &length); /* now read it */ + local_node->rows = atof(token); + + token = lsptok(NULL, &length); /* get :width */ + token = lsptok(NULL, &length); /* now read it */ + local_node->width = atoi(token); + token = lsptok(NULL, &length); /* get :indexed */ token = lsptok(NULL, &length); /* now read it */ @@ -1303,19 +1311,11 @@ _readRelOptInfo() token = lsptok(NULL, &length); /* get :pages */ token = lsptok(NULL, &length); /* now read it */ - local_node->pages = (unsigned int) atoi(token); + local_node->pages = atol(token); token = lsptok(NULL, &length); /* get :tuples */ token = lsptok(NULL, &length); /* now read it */ - local_node->tuples = (unsigned int) atoi(token); - - token = lsptok(NULL, &length); /* get :size */ - token = lsptok(NULL, &length); /* now read it */ - local_node->size = (unsigned int) atoi(token); - - token = lsptok(NULL, &length); /* get :width */ - token = lsptok(NULL, &length); /* now read it */ - local_node->width = (unsigned int) atoi(token); + local_node->tuples = atof(token); token = lsptok(NULL, &length); /* get :targetlist */ local_node->targetlist = nodeRead(true); /* now read it */ @@ -1349,6 +1349,34 @@ _readRelOptInfo() } /* ---------------- + * _readIndexOptInfo + * ---------------- + */ +static IndexOptInfo * +_readIndexOptInfo() +{ + IndexOptInfo *local_node; + char *token; + int length; + + local_node = makeNode(IndexOptInfo); + + token = lsptok(NULL, &length); /* get :indexoid */ + token = lsptok(NULL, &length); /* now read it */ + local_node->indexoid = (Oid) atoi(token); + + token = lsptok(NULL, &length); /* get :pages */ + token = lsptok(NULL, &length); /* now read it */ + local_node->pages = atol(token); + + token = lsptok(NULL, &length); /* get :tuples */ + token = lsptok(NULL, &length); /* now read it */ + local_node->tuples = atof(token); + + return local_node; +} + +/* ---------------- * _readTargetEntry * ---------------- */ @@ -1572,9 +1600,6 @@ _readNestPath() token = lsptok(NULL, &length); /* get :pathkeys */ local_node->path.pathkeys = nodeRead(true); /* now read it */ - token = lsptok(NULL, &length); /* get :pathinfo */ - local_node->pathinfo = nodeRead(true); /* now read it */ - /* * Not sure if these are nodes; they're declared as "struct path *". * For now, i'll just print the addresses. @@ -1626,9 +1651,6 @@ _readMergePath() token = lsptok(NULL, &length); /* get :pathkeys */ local_node->jpath.path.pathkeys = nodeRead(true); /* now read it */ - token = lsptok(NULL, &length); /* get :pathinfo */ - local_node->jpath.pathinfo = nodeRead(true); /* now read it */ - /* * Not sure if these are nodes; they're declared as "struct path *". * For now, i'll just print the addresses. @@ -1689,9 +1711,6 @@ _readHashPath() token = lsptok(NULL, &length); /* get :pathkeys */ local_node->jpath.path.pathkeys = nodeRead(true); /* now read it */ - token = lsptok(NULL, &length); /* get :pathinfo */ - local_node->jpath.pathinfo = nodeRead(true); /* now read it */ - /* * Not sure if these are nodes; they're declared as "struct path *". * For now, i'll just print the addresses. @@ -1762,10 +1781,6 @@ _readRestrictInfo() token = lsptok(NULL, &length); /* get :clause */ local_node->clause = nodeRead(true); /* now read it */ - token = lsptok(NULL, &length); /* get :selectivity */ - token = lsptok(NULL, &length); /* now read it */ - local_node->selectivity = atof(token); - token = lsptok(NULL, &length); /* get :subclauseindices */ local_node->subclauseindices = nodeRead(true); /* now read it */ @@ -1909,6 +1924,8 @@ parsePlanString(void) return_value = _readEState(); else if (!strncmp(token, "RELOPTINFO", length)) return_value = _readRelOptInfo(); + else if (!strncmp(token, "INDEXOPTINFO", length)) + return_value = _readIndexOptInfo(); else if (!strncmp(token, "TARGETENTRY", length)) return_value = _readTargetEntry(); else if (!strncmp(token, "RTE", length)) |