summaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
Commit message (Collapse)AuthorAgeFilesLines
* Suppress coredump when EXPLAINing query that is rewritten to includeTom Lane2001-01-271-2/+12
| | | | a NOTIFY.
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-241-2/+2
|
* Restructure handling of inheritance queries so that they work with outerTom Lane2000-11-121-15/+1
| | | | | | | | | | | | | | | | | joins, and clean things up a good deal at the same time. Append plan node no longer hacks on rangetable at runtime --- instead, all child tables are given their own RT entries during planning. Concept of multiple target tables pushed up into execMain, replacing bug-prone implementation within nodeAppend. Planner now supports generating Append plans for inheritance sets either at the top of the plan (the old way) or at the bottom. Expanding at the bottom is appropriate for tables used as sources, since they may appear inside an outer join; but we must still expand at the top when the target of an UPDATE or DELETE is an inheritance set, because we actually need a different targetlist and junkfilter for each target table in that case. Fortunately a target table can't be inside an outer join... Bizarre mutual recursion between union_planner and prepunion.c is gone --- in fact, union_planner doesn't really have much to do with union queries anymore, so I renamed it grouping_planner.
* Re-implement LIMIT/OFFSET as a plan node type, instead of a hack inTom Lane2000-10-261-1/+4
| | | | | | ExecutorRun. This allows LIMIT to work in a view. Also, LIMIT in a cursor declaration will behave in a reasonable fashion, whereas before it was overridden by the FETCH count.
* Reimplementation of UNION/INTERSECT/EXCEPT. INTERSECT/EXCEPT now meet theTom Lane2000-10-051-3/+21
| | | | | | | | | | | SQL92 semantics, including support for ALL option. All three can be used in subqueries and views. DISTINCT and ORDER BY work now in views, too. This rewrite fixes many problems with cross-datatype UNIONs and INSERT/SELECT where the SELECT yields different datatypes than the INSERT needs. I did that by making UNION subqueries and SELECT in INSERT be treated like subselects-in-FROM, thereby allowing an extra level of targetlist where the datatype conversions can be inserted safely. INITDB NEEDED!
* Subselects in FROM clause, per ISO syntax: FROM (SELECT ...) [AS] alias.Tom Lane2000-09-291-58/+73
| | | | | | | | | (Don't forget that an alias is required.) Views reimplemented as expanding to subselect-in-FROM. Grouping, aggregates, DISTINCT in views actually work now (he says optimistically). No UNION support in subselects/views yet, but I have some ideas about that. Rule-related permissions checking moved out of rewriter and into executor. INITDB REQUIRED!
* First cut at full support for OUTER JOINs. There are still a few looseTom Lane2000-09-121-7/+7
| | | | | ends to clean up (see my message of same date to pghackers), but mostly it works. INITDB REQUIRED!
* Reimplement nodeMaterial to use a temporary BufFile (or even memory, if theTom Lane2000-06-181-4/+1
| | | | | | | | | | materialized tupleset is small enough) instead of a temporary relation. This was something I was thinking of doing anyway for performance, and Jan says he needs it for TOAST because he doesn't want to cope with toasting noname relations. With this change, the 'noname table' support in heap.c is dead code, and I have accordingly removed it. Also clean up 'noname' plan handling in planner --- nonames are either sort or materialize plans, and it seems less confusing to handle them separately under those names.
* Ye-old pgindent run. Same 4-space tabs.Bruce Momjian2000-04-121-8/+8
|
* Implement column aliases on views "CREATE VIEW name (collist)".Thomas G. Lockhart2000-03-141-4/+28
| | | | | | | | | | | | | | | | | | Implement TIME WITH TIME ZONE type (timetz internal type). Remap length() for character strings to CHAR_LENGTH() for SQL92 and to remove the ambiguity with geometric length() functions. Keep length() for character strings for backward compatibility. Shrink stored views by removing internal column name list from visible rte. Implement min(), max() for time and timetz data types. Implement conversion of TIME to INTERVAL. Implement abs(), mod(), fac() for the int8 data type. Rename some math functions to generic names: round(), sqrt(), cbrt(), pow(), etc. Rename NUMERIC power() function to pow(). Fix int2 factorial to calculate result in int4. Enhance the Oracle compatibility function translate() to work with string arguments (from Edwin Ramirez). Modify pg_proc system table to remove OID holes.
* New cost model for planning, incorporating a penalty for random pageTom Lane2000-02-151-27/+13
| | | | | | | | | | | | | | | | | | | | | | | | | accesses versus sequential accesses, a (very crude) estimate of the effects of caching on random page accesses, and cost to evaluate WHERE- clause expressions. Export critical parameters for this model as SET variables. Also, create SET variables for the planner's enable flags (enable_seqscan, enable_indexscan, etc) so that these can be controlled more conveniently than via PGOPTIONS. Planner now estimates both startup cost (cost before retrieving first tuple) and total cost of each path, so it can optimize queries with LIMIT on a reasonable basis by interpolating between these costs. Same facility is a win for EXISTS(...) subqueries and some other cases. Redesign pathkey representation to achieve a major speedup in planning (I saw as much as 5X on a 10-way join); also minor changes in planner to reduce memory consumption by recycling discarded Path nodes and not constructing unnecessary lists. Minor cleanups to display more-plausible costs in some cases in EXPLAIN output. Initdb forced by change in interface to index cost estimation functions.
* Carry column aliases from the parser frontend. Enables queries likeThomas G. Lockhart2000-02-151-5/+5
| | | | | | | SELECT a FROM t1 tx (a); Allow join syntax, including queries like SELECT * FROM t1 NATURAL JOIN t2; Update RTE structure to hold column aliases in an Attr structure.
* Add:Bruce Momjian2000-01-261-2/+3
| | | | | | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
* Another round of planner/optimizer work. This is just restructuring andTom Lane2000-01-091-3/+3
| | | | | code cleanup; no major improvements yet. However, EXPLAIN does produce more intuitive outputs for nested loops with indexscans now...
* Tid access method feature from Hiroshi Inoue, Inoue@tpf.co.jpBruce Momjian1999-11-231-1/+18
|
* New NameStr macro to convert Name to Str. No need for var.data anymore.Bruce Momjian1999-11-071-2/+2
| | | | | | Fewer calls to nameout. Better use of RelationGetRelationName.
* Mega-commit to make heap_open/heap_openr/heap_close take anTom Lane1999-09-181-2/+5
| | | | | | | | | | | | | | | | | additional argument specifying the kind of lock to acquire/release (or 'NoLock' to do no lock processing). Ensure that all relations are locked with some appropriate lock level before being examined --- this ensures that relevant shared-inval messages have been processed and should prevent problems caused by concurrent VACUUM. Fix several bugs having to do with mismatched increment/decrement of relation ref count and mismatched heap_open/close (which amounts to the same thing). A bogus ref count on a relation doesn't matter much *unless* a SI Inval message happens to arrive at the wrong time, which is probably why we got away with this sloppiness for so long. Repair missing grab of AccessExclusiveLock in DROP TABLE, ALTER/RENAME TABLE, etc, as noted by Hiroshi. Recommend 'make clean all' after pulling this update; I modified the Relation struct layout slightly. Will post further discussion to pghackers list shortly.
* Eliminate elog()'s hardwired limit on length of an error message.Tom Lane1999-09-111-24/+3
| | | | | | | | | This change seems necessary in conjunction with long queries, and it cleans up some bogosity in connection with long EXPLAIN texts anyway. Note that current libpq will accept any length error message (at least until it runs out of memory); prior versions have a limit of 8K, but will cleanly discard excess error text, so there shouldn't be any big compatibility problems with old clients.
* Minor improvements to stringinfo package to make it moreTom Lane1999-08-311-1/+4
| | | | robust, since it's about to get used much more heavily.
* EXPLAIN didn't know about 'Materialize' plan nodes.Tom Lane1999-08-161-1/+4
|
* > > Prevent sorting if result is already sortedBruce Momjian1999-08-091-1/+3
| | | | | | | | | | | | | | > > > > 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
* Move some system includes into c.h, and remove duplicates.Bruce Momjian1999-07-171-3/+1
|
* Fix incorrect declaration of rtentry as 'ResTarget' where itTom Lane1999-07-171-2/+2
| | | | should be 'RangeTblEntry' ; explain.c had copied the erroneous code.
* Final cleanup.Bruce Momjian1999-07-161-5/+5
|
* Change #include's to use <> and "" as appropriate.Bruce Momjian1999-07-151-9/+9
|
* Remove unused #includes in *.c files.Bruce Momjian1999-07-151-5/+1
|
* Explain didn't handle inheritance correctly (it didn'tTom Lane1999-06-171-2/+1
| | | | manipulate rtable the same way executor does).
* pgindent run over code.Bruce Momjian1999-05-251-32/+16
|
* Rearrange top-level rewrite operations so that EXPLAIN worksTom Lane1999-05-091-8/+11
| | | | on queries involving UNION, EXCEPT, INTERSECT.
* Revise backend libpq interfaces so that messages to the frontendTom Lane1999-04-251-12/+7
| | | | | | can be generated in a buffer and then sent to the frontend in a single libpq call. This solves problems with NOTICE and ERROR messages generated in the middle of a data message or COPY OUT operation.
* Rename explain's "size" to "rows".Bruce Momjian1999-04-231-2/+2
|
* Remove Tee code, move to _deadcode.Bruce Momjian1999-03-231-4/+1
|
* Change my-function-name-- to my_function_name, and optimizer renames.Bruce Momjian1999-02-131-2/+2
|
* Rename Temp to Noname for noname tables.Bruce Momjian1999-02-091-3/+3
|
* Fixed nodeToString() to put out "<>" for NULL strings again.Jan Wieck1998-12-181-7/+7
| | | | | | More cleanups to appendStringInfo() usage in node/outfuncs.c. Jan
* more cleanups...of note, appendStringInfo now performs like sprintf(),Marc G. Fournier1998-12-141-9/+20
| | | | | | | | | | where you state a format and arguments. the old behavior required each appendStringInfo to have to have a sprintf() before it if any formatting was required. Also shortened several instances where there were multiple appendStringInfo() calls in a row, doing nothing more then adding one more word to the String, instead of doing them all in one call.
* Initial attempt to clean up the code...Marc G. Fournier1998-12-141-12/+7
| | | | | | Switch sprintf() to snprintf() Remove any/all #if 0 -or- #ifdef NOT_USED -or- #ifdef FALSE sections of code
* Fix using indices in OR.Vadim B. Mikheev1998-11-221-4/+9
| | | | EXPLAIN all indices used.
* EXPLAIN VERBOSE had a very high probability of triggeringTom Lane1998-11-081-20/+33
| | | | | | a backend core dump, because it was concatenating a potentially long string onto another string that didn't necessarily have enough room. Shame, shame.
* The patch does 2 things:Bruce Momjian1998-10-211-9/+43
| | | | | | | | | | | | Fixes a bug in the rule system that caused a crashing backend when a join-view with calculated column is used in subselect. Modifies EXPLAIN to explain rewritten queries instead of the plain SeqScan on a view. Rules can produce very deep MORE Jan.
* OK, folks, here is the pgindent output.Bruce Momjian1998-09-011-6/+6
|
* MergeSort was sometimes called mergejoin and was confusing. NowBruce Momjian1998-08-041-4/+5
| | | | it is now only mergejoin.
* EXPLAIN VERBOSE prints the plan, and now pretty-prints the plan toBruce Momjian1998-08-041-4/+7
| | | | the postmaster log file.
* Make EXPLAIN show output more clearly.Bruce Momjian1998-08-041-3/+3
|
* Fix explain for union and inheritance. Rename Append structureBruce Momjian1998-07-151-1/+36
| | | | members to be clearer. Fix cost computation for these.
* show the index used in an explainMarc G. Fournier1998-04-271-2/+9
| | | | From: Zeugswetter Andreas SARZ <Andreas.Zeugswetter@telecom.at>
* pgindent run before 6.3 release, with Thomas' requested changes.Bruce Momjian1998-02-261-15/+15
|
* Support for subselects.Vadim B. Mikheev1998-02-131-5/+47
|
* Change some mallocs to palloc.Bruce Momjian1997-12-291-3/+3
|
* Break parser functions into smaller files, group together.Bruce Momjian1997-11-251-3/+2
|