Commit Graph

337 Commits

Author SHA1 Message Date
Tom Lane 30da344cb1 Update comments about clause selectivity estimation. 1999-07-30 22:34:19 +00:00
Tom Lane 04578a9180 Further cleanups of indexqual processing: simplify control
logic in indxpath.c, avoid generation of redundant indexscan paths for the
same relation and index.
1999-07-30 04:07:25 +00:00
Tom Lane 7d572886d6 Fix coredump seen when doing mergejoin between indexed tables,
for example in the regression test database, try
select * from tenk1 t1, tenk1 t2 where t1.unique1 = t2.unique2;
6.5 has this same bug ...
1999-07-30 00:56:17 +00:00
Tom Lane 161be69544 Update comments for create_indexscan_node(). 1999-07-30 00:44:23 +00:00
Tom Lane ecbfafbe0e Add support for Case exprs to fix_indxqual_references,
so that Case works in WHERE join clauses.  Temporary patch --- this routine
is one of many that ought to be changed to use centralized expression-tree-
walking logic.
1999-07-29 02:48:05 +00:00
Tom Lane b62fdc13f0 Correct bug in best_innerjoin(): it should check all the
rels that the inner path needs to join to, but it was only checking for
the first one.  Failure could only have been observed with an OR-clause
that mentions 3 or more tables, and then only if the bogus path was
actually selected as cheapest ...
1999-07-27 06:23:12 +00:00
Tom Lane 9e7e29e6c9 First cut at doing LIKE/regex indexing optimization in
optimizer rather than parser.  This has many advantages, such as not
getting fooled by chance uses of operator names ~ and ~~ (the operators
are identified by OID now), and not creating useless comparison operations
in contexts where the comparisons will not actually be used as indexquals.
The new code also recognizes exact-match LIKE and regex patterns, and
produces an = indexqual instead of >= and <=.

This change does NOT fix the problem with non-ASCII locales: the code
still doesn't know how to generate an upper bound indexqual for non-ASCII
collation order.  But it's no worse than before, just the same deficiency
in a different place...

Also, dike out loc_restrictinfo fields in Plan nodes.  These were doing
nothing useful in the absence of 'expensive functions' optimization,
and they took a considerable amount of processing to fill in.
1999-07-27 03:51:11 +00:00
Tom Lane 49ed4dd779 Further work on planning of indexscans. Cleaned up interfaces
to index_selectivity so that it can be handed an indexqual clause list
rather than a bunch of assorted derivative data.
1999-07-25 23:07:26 +00:00
Tom Lane 8ae29a1d40 Remove 'restrictinfojoinid' field from RestrictInfo nodes.
The only place it was being used was as temporary storage in indxpath.c,
and the logic was wrong: the same restrictinfo node could get chosen to
carry the info for two different joins.  Right fix is to return a second
list of unjoined-relids parallel to the list of clause groups.
1999-07-25 17:53:27 +00:00
Tom Lane ac4913a0dd Clean up messy clause-selectivity code in clausesel.c; repair bug
identified by Hiroshi (incorrect cost attributed to OR clauses
after multiple passes through set_rest_selec()).  I think the code
was trying to allow selectivities of OR subclauses to be passed in
from outside, but noplace was actually passing any useful data, and
set_rest_selec() was passing wrong data.

Restructure representation of "indexqual" in IndexPath nodes so that
it is the same as for indxqual in completed IndexScan nodes: namely,
a toplevel list with an entry for each pass of the index scan, having
sublists that are implicitly-ANDed index qual conditions for that pass.
You don't want to know what the old representation was :-(

Improve documentation of OR-clause indexscan functions.

Remove useless 'notclause' field from RestrictInfo nodes.  (This might
force an initdb for anyone who has stored rules containing RestrictInfos,
but I do not think that RestrictInfo ever appears in completed plans.)
1999-07-24 23:21:14 +00:00
Tom Lane 348bdbce79 Minor code beautification, extensive improvement of
comments.  This file was full of obsolete and just plain wrong
commentary...
1999-07-23 03:34:49 +00:00
Bruce Momjian 3406901a29 Move some system includes into c.h, and remove duplicates. 1999-07-17 20:18:55 +00:00
Bruce Momjian a71802e12e Final cleanup. 1999-07-16 05:00:38 +00:00
Bruce Momjian 9b645d481c Update #include cleanups 1999-07-16 03:14:30 +00:00
Bruce Momjian a9591ce66a Change #include's to use <> and "" as appropriate. 1999-07-15 23:04:24 +00:00
Bruce Momjian 2e6b1e63a3 Remove unused #includes in *.c files. 1999-07-15 22:40:16 +00:00
Bruce Momjian 4b2c2850bf Clean up #include in /include directory. Add scripts for checking includes. 1999-07-15 15:21:54 +00:00
Tom Lane 8aea617c03 Several routines failed to cope with CASE expressions, and
indeed some of 'em were missing support for more node types than that...
1999-07-15 01:52:09 +00:00
Bruce Momjian 0cf1b79528 Cleanup of /include #include's, for 6.6 only. 1999-07-14 01:20:30 +00:00
Bruce Momjian db15dc05ad Fix for \do and ceil()/float. 1999-07-07 16:09:33 +00:00
Bruce Momjian e9c977da7d Fix spelling of variable name. 1999-07-07 09:36:45 +00:00
Bruce Momjian 9f7ac20e57 Cleanup of min tuple size. 1999-07-07 09:27:28 +00:00
Bruce Momjian 1391098851 Fix misspelling. 1999-07-07 09:11:15 +00:00
Bruce Momjian 97dfff832c Fix to prevent too large tuple from being created. 1999-07-03 00:33:04 +00:00
Tom Lane fd8e580bb7 Clean up problems with sublinks + grouping in planner. Not
sure if they are all fixed, because rewriter is now the stumbling block,
but at least some cases work that did not work before.
1999-06-21 01:20:57 +00:00
Tom Lane 974bdd94f9 On second thought, expression_tree_walker should handle bare
SubLink nodes after all ...
1999-06-21 01:18:02 +00:00
Bruce Momjian 326d8658ad Change form() to varargform() to prevent portability problems. 1999-06-19 04:54:23 +00:00
Tom Lane 86f36719db Create a generic expression-tree-walker subroutine, which
will gradually replace all of the boilerplate tree-walk-recursion code that
currently exists in O(N) slightly different forms in N subroutines.
I've had it with adding missing cases to these subroutines...
1999-06-19 03:41:45 +00:00
Tom Lane aaf2442472 Remove query_planner's overhasty rejection of cases where
tlist and qual are NULL.  It ought to handle these the same as the cases
where tlist contains only constant expressions, ie, be willing to generate
a Result-node plan.  This did not use to matter, but it does now because
union_planner will flatten the tlist when aggregates are present.  Thus,
'select count(1) from table' now causes query_planner to be given a null
tlist, and to duplicate 6.4's behavior we need it to give back a Result
plan rather than refusing the query.  6.4 was arguably doing the Wrong
Thing for this query, but I'm not going to open a semantics issue right
before 6.5 release ... can revisit that problem later.
1999-06-12 19:38:30 +00:00
Tom Lane acf242da97 Plug hole in dike: planner would coredump if query_planner
returned NULL, which it will do in some cases where an elog(ERROR) would
probably be more appropriate.  For the moment, generate a not-very-
informative error message rather than proceeding to certain coredump.
Probably ought to think about making query_planner elog instead of
returning NULL, but this is at least a safe change for now.
1999-06-12 19:27:41 +00:00
Tom Lane c37ecaf8d5 Fix errors in SELECT ... GROUP BY ... UNION SELECT ...
ye proverbial one-line patch (not counting five lines of comment so's
maybe it won't happen again)
1999-06-10 06:55:40 +00:00
Tom Lane b4210ae0f0 Fix problems with grouping/aggregation in queries that use
inheritance ... basically it was completely busted :-(
1999-06-06 17:38:11 +00:00
Tom Lane b325dab67a new_relation_targetlist used to cause about 8 separate (and
redundant) SearchSysCache searches per table column in an INSERT, which
accounted for a good percentage of the CPU time for INSERT ... VALUES().
Now it only does two searches in the typical case.
1999-05-29 01:48:06 +00:00
Bruce Momjian 278bbf4572 Make functions static or NOT_USED as appropriate. 1999-05-26 12:57:23 +00:00
Bruce Momjian fcff1cdf4e Another pgindent run. Sorry folks. 1999-05-25 22:43:53 +00:00
Bruce Momjian 4eadfe8754 Make 0x007f -> (unsigned)0x7f to make pgindent happy. 1999-05-25 22:04:56 +00:00
Bruce Momjian 07842084fe pgindent run over code. 1999-05-25 16:15:34 +00:00
Tom Lane 795f6ca66a Update commentary in sample GEQO config file. 1999-05-22 23:59:59 +00:00
Tom Lane b2f14e11ec Reduce default GEQO 'effort' setting to MEDIUM always.
This agrees with the documentation and seems like a more useful default
anyhow ...
1999-05-22 23:27:19 +00:00
Tom Lane b21005fa7c Allow GEQO effort to be specified numerically, as well as
symbolic LOW/MEDIUM/HIGH values --- needed for experiments with other
effort levels ...
1999-05-22 19:29:01 +00:00
Tom Lane c2f0d565f3 Now that hashjoin is reliable for large joins (knock on wood),
remove optimizer's arbitrary limit on how large a join it will use hashing
for.  (The limit was too large to prevent the problems we'd been seeing,
anyway...)
1999-05-18 21:36:10 +00:00
Tom Lane 353d36f979 Remove no-longer-used fields in Hash and HashJoin nodes. 1999-05-18 21:34:29 +00:00
Bruce Momjian 585c967720 Change resjunk to a boolean. 1999-05-17 17:03:51 +00:00
Tom Lane 0b8b1fe3aa Tighten coding in new_join_pathkey, which seems to be a hotspot
for GEQO ...
1999-05-17 00:26:33 +00:00
Tom Lane 1332c1e144 Change GEQO optimizer to release memory after each gene
is evaluated.  This bounds memory usage to something reasonable even
when many tables are being joined.
1999-05-17 00:25:34 +00:00
Tom Lane fecb2b0024 Minor code cleanup in optimizer. 1999-05-16 19:45:37 +00:00
Tom Lane f2ed835baf Fix some typos in geqo optimizer --- it now generates
reasonable plans again.  Still eats memory like there's no tomorrow,
however :-(.
1999-05-16 19:45:00 +00:00
Tom Lane 507a0a2ab0 Rip out QueryTreeList structure, root and branch. Querytree
lists are now plain old garden-variety Lists, allocated with palloc,
rather than specialized expansible-array data allocated with malloc.
This substantially simplifies their handling and eliminates several
sources of memory leakage.
Several basic types of erroneous queries (syntax error, attempt to
insert a duplicate key into a unique index) now demonstrably leak
zero bytes per query.
1999-05-13 07:29:22 +00:00
Jan Wieck 79c2576f77 Replaced targetlist entry in GroupClause by reference number
in Resdom and GroupClause so changing of resno's doesn't confuse
the grouping any more.

Jan
1999-05-12 15:02:39 +00:00
Bruce Momjian 4853495e03 Change error messages to oids come out as %u and not %d. Change has no
real affect now.
1999-05-10 00:46:32 +00:00