aboutsummaryrefslogtreecommitdiff
path: root/src/backend
Commit message (Collapse)AuthorAge
* Remove bogus code in oper_exact --- if it didn't find an exactTom Lane1999-08-23
| | | | | | | | | match then it tried for a self-commutative operator with the reversed input data types. This is pretty silly; there could never be such an operator, except maybe in binary-compatible-type scenarios, and we have oper_inexact for that. Besides which, the oprsanity regress test would complain about such an operator. Remove nonfunctional code and simplify routine calling convention accordingly.
* Further sort-order twiddling in optimizer: be smart aboutTom Lane1999-08-22
| | | | case where ORDER BY and GROUP BY request the same sort order.
* Further planner/optimizer cleanups. Move all set_tlist_referencesTom Lane1999-08-22
| | | | | | | | | | and fix_opids processing to a single recursive pass over the plan tree executed at the very tail end of planning, rather than haphazardly here and there at different places. Now that tlist Vars do not get modified until the very end, it's possible to get rid of the klugy var_equal and match_varid partial-matching routines, and just use plain equal() throughout the optimizer. This is a step towards allowing merge and hash joins to be done on expressions instead of only Vars ...
* Major revision of sort-node handling: push knowledge of queryTom Lane1999-08-21
| | | | | | | | | | | | | sort order down into planner, instead of handling it only at the very top level of the planner. This fixes many things. An explicit sort is now avoided if there is a cheaper alternative (typically an indexscan) not only for ORDER BY, but also for the internal sort of GROUP BY. It works even when there is no other reason (such as a WHERE condition) to consider the indexscan. It works for indexes on functions. It works for indexes on functions, backwards. It's just so cool... CAUTION: I have changed the representation of SortClause nodes, therefore THIS UPDATE BREAKS STORED RULES. You will need to initdb.
* Cleanups for int8: guard against null inputs in comparisonTom Lane1999-08-21
| | | | | operators (and some other places), fix rangechecks in int8 to int4 conversion (same problem we recently figured out in pg_atoi).
* Ooops ... I had left some test coding in selfuncs.c thatTom Lane1999-08-21
| | | | failed on 'field < textconstant' ...
* Old multi-byte bug. Forgot to rename #ifdef MB to #ifdef MULTIBYTETatsuo Ishii1999-08-18
| | | | Now SET NAMES working again...
* Remove extraneous SeqScan node that make_noname was insertingTom Lane1999-08-18
| | | | | | above a Sort or Materialize node. As far as I can tell, the only place that actually needed that was set_tlist_references, which was being lazy about checking to see if it had a noname node to fix or not...
* EXPLAIN didn't know about 'Materialize' plan nodes.Tom Lane1999-08-16
|
* Assign sort keys properly when there are duplicate entries inTom Lane1999-08-16
| | | | | pathkey list --- corrects misbehavior seen with multiple mergejoin clauses mentioning same variable.
* Major planner/optimizer revision: get rid of PathOrder node type,Tom Lane1999-08-16
| | | | | | | | | store all ordering information in pathkeys lists (which are now lists of lists of PathKeyItem nodes, not just lists of lists of vars). This was a big win --- the code is smaller and IMHO more understandable than it was, even though it handles more cases. I believe the node changes will not force an initdb for anyone; planner nodes don't show up in stored rules.
* Small updates to #include lists for pending optimizer checkin.Tom Lane1999-08-16
|
* Move funcid_get_rettype() to lsyscache.Tom Lane1999-08-16
|
* Add get_func_rettype() to general-use lsyscache routines,Tom Lane1999-08-16
| | | | since it's now needed in both optimizer and parser.
* Repair the check for redundant UNIQUE and PRIMARY KEY indices.Thomas G. Lockhart1999-08-15
| | | | | Also, improve it so that it checks for multi-column constraints. Thanks to Mark Dalphin <mdalphin@amgen.com> for reporting the problem.
* LispUnion routine didn't generate a proper union: anytimeTom Lane1999-08-14
| | | | | l2 contained more than one entry, there would be duplicates in the output list. Miscellaneous code beautification in other routines, too.
* Update comments about pathkeys.Tom Lane1999-08-13
|
* Clean up optimizer's handling of indexscan quals that need to beTom Lane1999-08-12
| | | | | | | | | | | | commuted (ie, the index var appears on the right). These are now handled the same way as merge and hash join quals that need to be commuted: the actual reversing of the clause only happens if we actually choose the path and generate a plan from it. Furthermore, the clause is only reversed in the 'indexqual' field of the plan, not in the 'indxqualorig' field. This allows the clause to still be recognized and removed from qpquals of upper level join plans. Also, simplify and generalize match_clause_to_indexkey; now it recognizes binary-compatible indexes for join as well as restriction clauses.
* Add commentary to show that even though ExecInitIndexScan()Tom Lane1999-08-12
| | | | | | | contains much code that looks like it will handle indexquals with the index key on either side of the operator, in fact indexquals must have the index key on the left because of limitations of the ScanKey machinery. Perhaps someone will be motivated to fix that someday...
* Minor cleanups and code beautification; eliminate someTom Lane1999-08-10
| | | | routines that are now dead code.
* Revise create_nestloop_node's handling of inner indexscan toTom Lane1999-08-10
| | | | | | | | work under a wider range of scenarios than it did --- it formerly did not handle a multi-pass inner scan, nor cases in which the inner scan's indxqualorig or non-index qual contained outer var references. I am not sure that these limitations could be hit in the existing optimizer, but they need to be fixed for future expansion.
* > > Prevent sorting if result is already sortedBruce Momjian1999-08-09
| | | | | | | | | | | | | | > > > > was implemented by Jan Wieck. > > His work is for ascending order cases. > > > > Here is a patch to prevent sorting also in descending > > order cases. > > Because I had already changed _bt_first() to position > > backward correctly before v6.5,this patch would work. > > Hiroshi Inoue Inoue@tpf.co.jp
* Clean up tlist.c tree-walking routines withTom Lane1999-08-09
| | | | expression_tree_mutator.
* Store -1 in attdisbursion to signal 'no duplicates in column'.Tom Lane1999-08-09
| | | | Centralize att_disbursion readout logic.
* Move get_attdisbursion to lsyscache. Clean up get_typdefault.Tom Lane1999-08-09
|
* Re-use free space on index pages with duplicates.Vadim B. Mikheev1999-08-09
|
* Rewrite fix_indxqual_references, which was entirely bogus forTom Lane1999-08-09
| | | | | | | 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...
* Clean up routines in setrefs.c by replacing individual treeTom Lane1999-08-09
| | | | walking logic with expression_tree_walker/mutator calls.
* Create a standardized expression_tree_mutator support routineTom Lane1999-08-09
| | | | | | 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.
* Fix nbtree's failure to clear BTScans list during xact abort.Tom Lane1999-08-08
| | | | | | 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()?
* For a unique-key attribute (no duplicate values), vacuum analyzeTom Lane1999-08-08
| | | | was recording a disbursion of 0, not the correct value 1/numberOfRows.
* Revise generation of hashjoin paths: generate one path perTom Lane1999-08-06
| | | | | | | | | | | | | | | 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.
* Revise parse_coerce() to handle coercion of int and floatTom Lane1999-08-05
| | | | | constants, not only string constants, at parse time. Get rid of parser_typecast2(), which is bogus and redundant...
* Further selectivity-estimation work. Speed up eqsel()Tom Lane1999-08-02
| | | | | | | | | (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.
* First step in fixing selectivity-estimation code. eqsel andTom Lane1999-08-01
| | | | | | | | | | 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.
* Update comments about clause selectivity estimation.Tom Lane1999-07-30
|
* Make usecatupd disabled for normal users, and allow normal users toBruce Momjian1999-07-30
| | | | update temp tables with this setting.
* Further cleanups of indexqual processing: simplify controlTom Lane1999-07-30
| | | | | logic in indxpath.c, avoid generation of redundant indexscan paths for the same relation and index.
* Remove extra #endifBruce Momjian1999-07-30
|
* Fix coredump seen when doing mergejoin between indexed tables,Tom Lane1999-07-30
| | | | | | 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 ...
* Update comments for create_indexscan_node().Tom Lane1999-07-30
|
* Add support for Case exprs to fix_indxqual_references,Tom Lane1999-07-29
| | | | | | 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.
* Add equal() funcs for Case nodes ... amazing we had notTom Lane1999-07-29
| | | | detected this omission before. Miscellaneous other cleanups.
* Allow a_expr not just AexprConst in the right-hand list ofTom Lane1999-07-28
| | | | | IN and NOT IN operators. Rewrite grotty implementation of IN-list parsing ... look Ma, no global variable ...
* Correct bug in best_innerjoin(): it should check all theTom Lane1999-07-27
| | | | | | | 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 ...
* First cut at doing LIKE/regex indexing optimization inTom Lane1999-07-27
| | | | | | | | | | | | | | | | | | 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.
* Further work on planning of indexscans. Cleaned up interfacesTom Lane1999-07-25
| | | | | to index_selectivity so that it can be handed an indexqual clause list rather than a bunch of assorted derivative data.
* Remove 'restrictinfojoinid' field from RestrictInfo nodes.Tom Lane1999-07-25
| | | | | | | 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.
* Clean up messy clause-selectivity code in clausesel.c; repair bugTom Lane1999-07-24
| | | | | | | | | | | | | | | | | | | | 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.)
* Minor code beautification, extensive improvement ofTom Lane1999-07-23
| | | | | comments. This file was full of obsolete and just plain wrong commentary...