Skip to content
Snippets Groups Projects
  1. Aug 21, 1999
    • Tom Lane's avatar
      Major revision of sort-node handling: push knowledge of query · db436adf
      Tom Lane authored
      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.
      db436adf
  2. Aug 16, 1999
  3. Aug 12, 1999
    • Tom Lane's avatar
      Clean up optimizer's handling of indexscan quals that need to be · 8f9f6e51
      Tom Lane authored
      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.
      8f9f6e51
  4. Aug 10, 1999
  5. Aug 09, 1999
  6. Aug 08, 1999
  7. Aug 06, 1999
    • Tom Lane's avatar
      Revise generation of hashjoin paths: generate one path per · e1fad50a
      Tom Lane authored
      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.
      e1fad50a
  8. Aug 05, 1999
  9. Aug 01, 1999
    • Tom Lane's avatar
      First step in fixing selectivity-estimation code. eqsel and · 44878506
      Tom Lane authored
      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.
      44878506
  10. Jul 31, 1999
  11. Jul 30, 1999
  12. Jul 27, 1999
    • Tom Lane's avatar
      Correct bug in best_innerjoin(): it should check all the · b62fdc13
      Tom Lane authored
      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 ...
      b62fdc13
    • Tom Lane's avatar
      First cut at doing LIKE/regex indexing optimization in · 9e7e29e6
      Tom Lane authored
      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.
      9e7e29e6
  13. Jul 26, 1999
  14. Jul 25, 1999
    • Tom Lane's avatar
      Remove 'restrictinfojoinid' field from RestrictInfo nodes. · 8ae29a1d
      Tom Lane authored
      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.
      8ae29a1d
    • Tom Lane's avatar
      Clean up messy clause-selectivity code in clausesel.c; repair bug · ac4913a0
      Tom Lane authored
      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.)
      ac4913a0
  15. Jul 20, 1999
  16. Jul 19, 1999
  17. Jul 18, 1999
  18. Jul 17, 1999
Loading