Tom Lane [Mon, 9 Aug 1999 01:01:42 +0000 (01:01 +0000)]
Rewrite fix_indxqual_references, which was entirely bogus for
multi-scan indexscan plans; it tried to use the same table-to-index
attribute mapping for all the scans, even if they used different indexes.
It would klugily work as long as OR indexquals never used multikey indexes,
but that's not likely to hold up much longer...
Tom Lane [Mon, 9 Aug 1999 00:51:26 +0000 (00:51 +0000)]
Create a standardized expression_tree_mutator support routine
to go along with expression_tree_walker. (_walker is not suitable for
routines that need to alter the tree structure significantly.) Other minor
cleanups in clauses.c.
Tom Lane [Sun, 8 Aug 1999 20:12:52 +0000 (20:12 +0000)]
Fix nbtree's failure to clear BTScans list during xact abort.
Also, move responsibility for calling vc_abort into main xact.c list of
things-to-call-at-abort. What in the world was it doing down inside of
TransactionIdAbort()?
Fix cross-reference markup so that only the *title* of the Operators
chapter is included, not the chapter itself.
Thanks to Evelyn Mitchell <efm@tummy.com> for pointing it out.
Remove explicit references to ref/ path in file names; use vpath instead.
Fix rules for man pages to ensure double-pass to get cross references.
Add a few new man pages.
Try to clarify characteristics of the SERIAL type.
Fix source indenting, which does not affect output.
Note: still need docs on NUMERIC and DECIMAL
(and let's not talk about regression tests :()
Tom Lane [Fri, 6 Aug 1999 04:00:17 +0000 (04:00 +0000)]
Revise generation of hashjoin paths: generate one path per
hashjoinable clause, not one path for a randomly-chosen element of each
set of clauses with the same join operator. That is, if you wrote
SELECT ... WHERE t1.f1 = t2.f2 and t1.f3 = t2.f4,
and both '=' ops were the same opcode (say, all four fields are int4),
then the system would either consider hashing on f1=f2 or on f3=f4,
but it would *not* consider both possibilities. Boo hiss.
Also, revise estimation of hashjoin costs to include a penalty when the
inner join var has a high disbursion --- ie, the most common value is
pretty common. This tends to lead to badly skewed hash bucket occupancy
and way more comparisons than you'd expect on average.
I imagine that the cost calculation still needs tweaking, but at least
it generates a more reasonable plan than before on George Young's example.
Tom Lane [Thu, 5 Aug 1999 02:33:54 +0000 (02:33 +0000)]
Revise parse_coerce() to handle coercion of int and float
constants, not only string constants, at parse time. Get rid of
parser_typecast2(), which is bogus and redundant...
Tom Lane [Tue, 3 Aug 1999 00:09:32 +0000 (00:09 +0000)]
Fix ELF test so it doesn't spit up on all non-ELF systems...
use Autoconf-approved method of testing for predefined symbols, and move
it down to where we know what compiler to run and how to run it.
Tom Lane [Mon, 2 Aug 1999 02:05:41 +0000 (02:05 +0000)]
Further selectivity-estimation work. Speed up eqsel()
(it should just call the given operator, not look up an = operator).
Fix intltsel() so that all numeric data types are converted to double
before trying to estimate where the given comparison value is in the
known range of column values. intltsel() still needs work, or replacement,
for non-numeric data types ... but for nonintegral numeric types it
should now be delivering reasonable estimates.
Bruce Momjian [Sun, 1 Aug 1999 16:30:05 +0000 (16:30 +0000)]
I didn't see any further discussion so here is, I hope, a clean fix to
configure.in to determine if a system is ELF or not. Note that some
of the tests earlier may be redundant but I took the safest route.
Tom Lane [Sun, 1 Aug 1999 04:54:25 +0000 (04:54 +0000)]
First step in fixing selectivity-estimation code. eqsel and
neqsel now behave as per my suggestions in pghackers a few days ago.
selectivity for < > <= >= should work OK for integral types as well, but
still need work for nonintegral types. Since these routines have never
actually executed before :-(, this may result in some significant changes
in the optimizer's choices of execution plans. Let me know if you see
any serious misbehavior.
CAUTION: THESE CHANGES REQUIRE INITDB. pg_statistic table has changed.
Tom Lane [Fri, 30 Jul 1999 04:07:25 +0000 (04:07 +0000)]
Further cleanups of indexqual processing: simplify control
logic in indxpath.c, avoid generation of redundant indexscan paths for the
same relation and index.
Tom Lane [Fri, 30 Jul 1999 00:56:17 +0000 (00:56 +0000)]
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 ...
Tom Lane [Thu, 29 Jul 1999 02:48:05 +0000 (02:48 +0000)]
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.
Tom Lane [Wed, 28 Jul 1999 17:39:38 +0000 (17:39 +0000)]
Allow a_expr not just AexprConst in the right-hand list of
IN and NOT IN operators. Rewrite grotty implementation of IN-list
parsing ... look Ma, no global variable ...
Tom Lane [Tue, 27 Jul 1999 06:23:12 +0000 (06:23 +0000)]
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 ...
Tom Lane [Tue, 27 Jul 1999 03:53:54 +0000 (03:53 +0000)]
My recent optimizer changes caused a different plan to
be picked for one of the complex joins in rules test ... leading to
a different output ordering ...
Tom Lane [Tue, 27 Jul 1999 03:51:11 +0000 (03:51 +0000)]
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.
Tom Lane [Sun, 25 Jul 1999 23:07:26 +0000 (23:07 +0000)]
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.
Tom Lane [Sun, 25 Jul 1999 17:53:27 +0000 (17:53 +0000)]
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.
Tom Lane [Sat, 24 Jul 1999 23:21:14 +0000 (23:21 +0000)]
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.)
Tom Lane [Fri, 23 Jul 1999 03:00:10 +0000 (03:00 +0000)]
Exit cleanups I made yesterday caused pq_close() to be
invoked during exit from a standalone backend, leading to core dump.
This is the cause of the recently reported initdb-time crash :-(.
Sorry folks...
Complete merge of all old man page information.
lisp.sgml is a placeholder for Eric Marsden's upcoming contribution.
catalogs.sgml is not yet marked up or integrated.
It should perhaps become an appendix.
Bruce Momjian [Tue, 20 Jul 1999 17:20:43 +0000 (17:20 +0000)]
While I was running some tests in psql, trying to figure out how to change
the query string to handle any length, I discovered that under certain
conditions, psql will core dump when handling long strings. Thus, the
patch. It was caused by a buffer overrun, probably not noticeable in a lot
of cases, but pretty noticeable in mine.
Problem was caused by the fact that the length check is only performed after
the check for a ; to get the end of the query and execute.
Tom Lane [Tue, 20 Jul 1999 00:18:01 +0000 (00:18 +0000)]
Complain about INSERT ... SELECT ... ORDER BY, which we do not
support, but which the grammar was accepting. Also, fix several bugs
having to do with failure to copy fields up from a subselect to a select
or insert node.