Commit Graph

66 Commits

Author SHA1 Message Date
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 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 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
Bruce Momjian 326d8658ad Change form() to varargform() to prevent portability problems. 1999-06-19 04:54:23 +00:00
Bruce Momjian fcff1cdf4e Another pgindent run. Sorry folks. 1999-05-25 22:43:53 +00:00
Bruce Momjian 07842084fe pgindent run over code. 1999-05-25 16:15:34 +00:00
Bruce Momjian dc02fd709f cleanups 1999-03-18 19:59:55 +00:00
Bruce Momjian 1ed5cbbfd8 Final optimizer cleanups. 1999-02-22 05:26:58 +00:00
Marc G. Fournier 8c3e8a8a0e From: Tatsuo Ishii <t-ishii@sra.co.jp>
Ok. I made patches replacing all of "#if FALSE" or "#if 0" to "#ifdef
NOT_USED" for current. I have tested these patches in that the
postgres binaries are identical.
1999-02-21 03:49:55 +00:00
Bruce Momjian 31cce21fb0 Fix bushy plans. Cleanup. 1999-02-18 00:49:48 +00:00
Bruce Momjian 56bb23a8fe optimizer rename 1999-02-15 05:50:02 +00:00
Bruce Momjian 50034a852d optimizer rename 1999-02-15 05:28:10 +00:00
Bruce Momjian c5449d5354 otherrels is now unjoined_rels 1999-02-15 05:21:12 +00:00
Bruce Momjian ba2883b264 Remove duplicate geqo functions, and more optimizer cleanup 1999-02-15 03:22:37 +00:00
Tom Lane 944d3c395e Replace non-idiomatic nconc(x, lcons(y, NIL)) with lappend(x, y). 1999-02-15 02:04:58 +00:00
Tom Lane dec354ca97 Fix a number of places that made faulty assumptions about
what is_opclause will accept.
1999-02-15 01:06:59 +00:00
Bruce Momjian 6724a50787 Change my-function-name-- to my_function_name, and optimizer renames. 1999-02-13 23:22:53 +00:00
Bruce Momjian d244df95db More optimizer speedups. 1999-02-11 14:59:09 +00:00
Bruce Momjian 9dbb0efb0b Optmizer cleanup 1999-02-10 21:02:50 +00:00
Bruce Momjian f859c81c18 Rename Path.keys to Path.pathkeys. Too many 'keys' used for other things. 1999-02-10 03:52:54 +00:00
Bruce Momjian fe35ffe7e0 Major optimizer improvement for joining a large number of tables. 1999-02-09 03:51:42 +00:00
Bruce Momjian 54e5d25666 Optimizer cleanup. 1999-02-08 04:29:25 +00:00
Bruce Momjian 6e2edaf4b8 Optimizer cleanup. 1999-02-05 19:59:31 +00:00
Bruce Momjian 9322950aa4 Cleanup of source files where 'return' or 'var =' is alone on a line. 1999-02-03 21:18:02 +00:00
Bruce Momjian 8d9237d485 Optimizer rename ClauseInfo -> RestrictInfo. Update optimizer README. 1999-02-03 20:15:53 +00:00
Bruce Momjian 748e300317 Fix for AND/OR handling. 1998-09-21 15:41:28 +00:00
Bruce Momjian fa1a8d6a97 OK, folks, here is the pgindent output. 1998-09-01 04:40:42 +00:00
Bruce Momjian af74855a60 Renaming cleanup, no pgindent yet. 1998-09-01 03:29:17 +00:00
Bruce Momjian 0705b02f18 OR clause index fix 1998-08-31 07:19:56 +00:00
Bruce Momjian 7971539020 heap_fetch requires buffer pointer, must be released; heap_getnext
no longer returns buffer pointer, can be gotten from scan;
	descriptor; bootstrap can create multi-key indexes;
pg_procname index now is multi-key index; oidint2, oidint4, oidname
are gone (must be removed from regression tests); use System Cache
rather than sequential scan in many places; heap_modifytuple no
longer takes buffer parameter; remove unused buffer parameter in
a few other functions; oid8 is not index-able; remove some use of
single-character variable names; cleanup Buffer variables usage
and scan descriptor looping; cleaned up allocation and freeing of
tuples; 18k lines of diff;
1998-08-19 02:04:17 +00:00
Thomas G. Lockhart 4c91723d35 Check for null pointer returned from get_opname().
Don't bother checking for alternate strategies if so
 since it was more likely a function or some other non-operator anyway.
1998-08-16 05:37:04 +00:00
Thomas G. Lockhart 6912beea70 Allow binary-compatible indices to be considered when checking for valid
indices for restriction clauses containing a constant.
Note that if an index does not match directly (usually because the types
 on both side of the clause don't match), and if a binary-compatible index
 is identified, then the operator function will be replaced by a new
 one. Should not be a problem, but be sure that if types are listed as
 being binary compatible (in parse_coerce.h) then the comparison functions
 are also binary-compatible, giving equivalent results.
1998-08-14 16:13:07 +00:00
Bruce Momjian 024d5f74ba index strategy cleanup 1998-08-11 19:32:39 +00:00
Bruce Momjian 956b91a944 Cleanups of optimizer. 1998-08-10 04:49:39 +00:00
Bruce Momjian 2d32d909b5 Cleanup optimizer function names and clarify code. 1998-08-10 02:26:40 +00:00
Bruce Momjian d9be0ff432 MergeSort was sometimes called mergejoin and was confusing. Now
it is now only mergejoin.
1998-08-04 16:44:31 +00:00
Bruce Momjian c8b42a6151 Update flow chart. 1998-08-04 00:42:14 +00:00
Bruce Momjian b88e9784b6 Cleanup of OR processing. 1998-08-03 05:49:24 +00:00
Bruce Momjian 39844ac2c3 Fix for OR handling with multiple indexes. 1998-08-02 07:10:38 +00:00
Bruce Momjian 2c6b370e64 Cleanup of OR fix. 1998-08-01 22:44:55 +00:00
Bruce Momjian 0a2e5cdfc9 Allow index use with OR clauses. 1998-08-01 22:12:13 +00:00
Vadim B. Mikheev 83d3626b1f Matching clauses to functional indices was broken, now fixed. 1998-07-31 15:10:40 +00:00
Vadim B. Mikheev be8300b18f Use Snapshot in heap access methods. 1998-07-27 19:38:40 +00:00
Bruce Momjian 584f9438ca Rename Rel to RelOptInfo. 1998-07-18 04:22:52 +00:00