1. 12 12月, 2002 1 次提交
    • T
      Phase 2 of read-only-plans project: restructure expression-tree nodes · a0bf885f
      Tom Lane 提交于
      so that all executable expression nodes inherit from a common supertype
      Expr.  This is somewhat of an exercise in code purity rather than any
      real functional advance, but getting rid of the extra Oper or Func node
      formerly used in each operator or function call should provide at least
      a little space and speed improvement.
      initdb forced by changes in stored-rules representation.
      a0bf885f
  2. 26 11月, 2002 1 次提交
  3. 19 9月, 2002 1 次提交
    • T
      Extend pg_cast castimplicit column to a three-way value; this allows us · b26dfb95
      Tom Lane 提交于
      to be flexible about assignment casts without introducing ambiguity in
      operator/function resolution.  Introduce a well-defined promotion hierarchy
      for numeric datatypes (int2->int4->int8->numeric->float4->float8).
      Change make_const to initially label numeric literals as int4, int8, or
      numeric (never float8 anymore).
      Explicitly mark Func and RelabelType nodes to indicate whether they came
      from a function call, explicit cast, or implicit cast; use this to do
      reverse-listing more accurately and without so many heuristics.
      Explicit casts to char, varchar, bit, varbit will truncate or pad without
      raising an error (the pre-7.2 behavior), while assigning to a column without
      any explicit cast will still raise an error for wrong-length data like 7.3.
      This more nearly follows the SQL spec than 7.2 behavior (we should be
      reporting a 'completion condition' in the explicit-cast cases, but we have
      no mechanism for that, so just do silent truncation).
      Fix some problems with enforcement of typmod for array elements;
      it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
      Provide a generalized array_length_coerce() function to replace the
      specialized per-array-type functions that used to be needed (and were
      missing for NUMERIC as well as all the datetime types).
      Add missing conversions int8<->float4, text<->numeric, oid<->int8.
      initdb forced.
      b26dfb95
  4. 11 9月, 2002 1 次提交
    • T
      Tweak querytree-dependency-extraction code so that columns of tables · 6fdc44be
      Tom Lane 提交于
      that are explicitly JOINed are not considered dependencies unless they
      are actually used in the query: mere presence in the joinaliasvars
      list of a JOIN RTE doesn't count as being used.  The patch touches
      a number of files because I needed to generalize the API of
      query_tree_walker to support an additional flag bit, but the changes
      are otherwise quite small.
      6fdc44be
  5. 05 9月, 2002 1 次提交
  6. 02 9月, 2002 1 次提交
  7. 30 8月, 2002 1 次提交
  8. 03 8月, 2002 1 次提交
    • T
      ALTER TABLE DROP COLUMN works. Patch by Christopher Kings-Lynne, · 38bb77a5
      Tom Lane 提交于
      code review by Tom Lane.  Remaining issues: functions that take or
      return tuple types are likely to break if one drops (or adds!)
      a column in the table defining the type.  Need to think about what
      to do here.
      
      Along the way: some code review for recent COPY changes; mark system
      columns attnotnull = true where appropriate, per discussion a month ago.
      38bb77a5
  9. 21 6月, 2002 1 次提交
  10. 22 3月, 2002 1 次提交
    • T
      A little further progress on schemas: push down RangeVars into · 108a0ec8
      Tom Lane 提交于
      addRangeTableEntry calls.  Remove relname field from RTEs, since
      it will no longer be a useful unique identifier of relations;
      we want to encourage people to rely on the relation OID instead.
      Further work on dumping qual expressions in EXPLAIN, too.
      108a0ec8
  11. 12 3月, 2002 1 次提交
    • T
      Restructure representation of join alias variables. An explicit JOIN · 6eeb95f0
      Tom Lane 提交于
      now has an RTE of its own, and references to its outputs now are Vars
      referencing the JOIN RTE, rather than CASE-expressions.  This allows
      reverse-listing in ruleutils.c to use the correct alias easily, rather
      than painfully reverse-engineering the alias namespace as it used to do.
      Also, nested FULL JOINs work correctly, because the result of the inner
      joins are simple Vars that the planner can cope with.  This fixes a bug
      reported a couple times now, notably by Tatsuo on 18-Nov-01.  The alias
      Vars are expanded into COALESCE expressions where needed at the very end
      of planning, rather than during parsing.
      Also, beginnings of support for showing plan qualifier expressions in
      EXPLAIN.  There are probably still cases that need work.
      initdb forced due to change of stored-rule representation.
      6eeb95f0
  12. 05 3月, 2002 1 次提交
  13. 01 3月, 2002 1 次提交
  14. 13 11月, 2001 1 次提交
  15. 28 10月, 2001 1 次提交
  16. 25 10月, 2001 1 次提交
  17. 15 8月, 2001 1 次提交
  18. 05 6月, 2001 1 次提交
    • T
      Further work on making use of new statistics in planner. Adjust APIs · 7c579fa1
      Tom Lane 提交于
      of costsize.c routines to pass Query root, so that costsize can figure
      more things out by itself and not be so dependent on its callers to tell
      it everything it needs to know.  Use selectivity of hash or merge clause
      to estimate number of tuples processed internally in these joins
      (this is more useful than it would've been before, since eqjoinsel is
      somewhat more accurate than before).
      7c579fa1
  19. 21 5月, 2001 1 次提交
    • T
      Modify optimizer data structures so that IndexOptInfo lists built for · be03eb25
      Tom Lane 提交于
      create_index_paths are not immediately discarded, but are available for
      subsequent planner work.  This allows avoiding redundant syscache lookups
      in several places.  Change interface to operator selectivity estimation
      procedures to allow faster and more flexible estimation.
      Initdb forced due to change of pg_proc entries for selectivity functions!
      be03eb25
  20. 07 5月, 2001 1 次提交
    • T
      Rewrite of planner statistics-gathering code. ANALYZE is now available as · f905d65e
      Tom Lane 提交于
      a separate statement (though it can still be invoked as part of VACUUM, too).
      pg_statistic redesigned to be more flexible about what statistics are
      stored.  ANALYZE now collects a list of several of the most common values,
      not just one, plus a histogram (not just the min and max values).  Random
      sampling is used to make the process reasonably fast even on very large
      tables.  The number of values and histogram bins collected is now
      user-settable via an ALTER TABLE command.
      
      There is more still to do; the new stats are not being used everywhere
      they could be in the planner.  But the remaining changes for this project
      should be localized, and the behavior is already better than before.
      
      A not-very-related change is that sorting now makes use of btree comparison
      routines if it can find one, rather than invoking '<' twice.
      f905d65e
  21. 28 3月, 2001 1 次提交
  22. 22 3月, 2001 1 次提交
  23. 25 1月, 2001 1 次提交
  24. 18 1月, 2001 1 次提交
  25. 15 12月, 2000 1 次提交
    • T
      Planner speedup hacking. Avoid saving useless pathkeys, so that path · ea166f11
      Tom Lane 提交于
      comparison does not consider paths different when they differ only in
      uninteresting aspects of sort order.  (We had a special case of this
      consideration for indexscans already, but generalize it to apply to
      ordered join paths too.)  Be stricter about what is a canonical pathkey
      to allow faster pathkey comparison.  Cache canonical pathkeys and
      dispersion stats for left and right sides of a RestrictInfo's clause,
      to avoid repeated computation.  Total speedup will depend on number of
      tables in a query, but I see about 4x speedup of planning phase for
      a sample seven-table query.
      ea166f11
  26. 13 12月, 2000 1 次提交
  27. 12 11月, 2000 1 次提交
    • T
      Restructure handling of inheritance queries so that they work with outer · 6543d81d
      Tom Lane 提交于
      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.
      6543d81d
  28. 09 11月, 2000 1 次提交
  29. 06 10月, 2000 1 次提交
    • T
      Reimplementation of UNION/INTERSECT/EXCEPT. INTERSECT/EXCEPT now meet the · 05e3d0ee
      Tom Lane 提交于
      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!
      05e3d0ee
  30. 30 9月, 2000 1 次提交
    • T
      Subselects in FROM clause, per ISO syntax: FROM (SELECT ...) [AS] alias. · 3a94e789
      Tom Lane 提交于
      (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!
      3a94e789
  31. 13 9月, 2000 1 次提交
  32. 20 6月, 2000 1 次提交
  33. 30 5月, 2000 1 次提交
  34. 18 4月, 2000 1 次提交
  35. 13 4月, 2000 1 次提交
  36. 21 3月, 2000 1 次提交
    • T
      Restructure planning code so that preprocessing of targetlist and quals · 3ee8f7e2
      Tom Lane 提交于
      to simplify constant expressions and expand SubLink nodes into SubPlans
      is done in a separate routine subquery_planner() that calls union_planner().
      We formerly did most of this work in query_planner(), but that's the
      wrong place because it may never see the real targetlist.  Splitting
      union_planner into two routines also allows us to avoid redundant work
      when union_planner is invoked recursively for UNION and inheritance
      cases.  Upshot is that it is now possible to do something like
      select float8(count(*)) / (select count(*) from int4_tbl)  from int4_tbl
      group by f1;
      which has never worked before.
      3ee8f7e2
  37. 15 3月, 2000 1 次提交
    • T
      Implement column aliases on views "CREATE VIEW name (collist)". · 64568100
      Thomas G. Lockhart 提交于
      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.
      64568100
  38. 16 2月, 2000 1 次提交
    • T
      New cost model for planning, incorporating a penalty for random page · b1577a7c
      Tom Lane 提交于
      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.
      b1577a7c
  39. 15 2月, 2000 1 次提交
  40. 03 2月, 2000 1 次提交