1. 26 Aug, 2005 1 commit
  2. 12 Aug, 2005 1 commit
    • Tom Lane's avatar
      Solve the problem of OID collisions by probing for duplicate OIDs · 721e5378
      Tom Lane authored
      whenever we generate a new OID.  This prevents occasional duplicate-OID
      errors that can otherwise occur once the OID counter has wrapped around.
      Duplicate relfilenode values are also checked for when creating new
      physical files.  Per my recent proposal.
      721e5378
  3. 25 Jun, 2005 1 commit
  4. 20 Jun, 2005 1 commit
  5. 19 May, 2005 1 commit
  6. 11 May, 2005 1 commit
  7. 06 May, 2005 1 commit
  8. 28 Apr, 2005 1 commit
    • Tom Lane's avatar
      Implement sharable row-level locks, and use them for foreign key references · bedb78d3
      Tom Lane authored
      to eliminate unnecessary deadlocks.  This commit adds SELECT ... FOR SHARE
      paralleling SELECT ... FOR UPDATE.  The implementation uses a new SLRU
      data structure (managed much like pg_subtrans) to represent multiple-
      transaction-ID sets.  When more than one transaction is holding a shared
      lock on a particular row, we create a MultiXactId representing that set
      of transactions and store its ID in the row's XMAX.  This scheme allows
      an effectively unlimited number of row locks, just as we did before,
      while not costing any extra overhead except when a shared lock actually
      has to be shared.   Still TODO: use the regular lock manager to control
      the grant order when multiple backends are waiting for a row lock.
      
      Alvaro Herrera and Tom Lane.
      bedb78d3
  9. 14 Apr, 2005 2 commits
    • Tom Lane's avatar
      Completion of project to use fixed OIDs for all system catalogs and · 162bd08b
      Tom Lane authored
      indexes.  Replace all heap_openr and index_openr calls by heap_open
      and index_open.  Remove runtime lookups of catalog OID numbers in
      various places.  Remove relcache's support for looking up system
      catalogs by name.  Bulky but mostly very boring patch ...
      162bd08b
    • Tom Lane's avatar
      First phase of project to use fixed OIDs for all system catalogs and · 7c13781e
      Tom Lane authored
      indexes.  Extend the macros in include/catalog/*.h to carry the info
      about hand-assigned OIDs, and adjust the genbki script and bootstrap
      code to make the relations actually get those OIDs.  Remove the small
      number of RelOid_pg_foo macros that we had in favor of a complete
      set named like the catname.h and indexing.h macros.  Next phase will
      get rid of internal use of names for looking up catalogs and indexes;
      but this completes the changes forcing an initdb, so it looks like a
      good place to commit.
      Along the way, I made the shared relations (pg_database etc) not be
      'bootstrap' relations any more, so as to reduce the number of hardwired
      entries and simplify changing those relations in future.  I'm not
      sure whether they ever really needed to be handled as bootstrap
      relations, but it seems to work fine to not do so now.
      7c13781e
  10. 29 Mar, 2005 1 commit
    • Tom Lane's avatar
      Convert oidvector and int2vector into variable-length arrays. This · 70c9763d
      Tom Lane authored
      change saves a great deal of space in pg_proc and its primary index,
      and it eliminates the former requirement that INDEX_MAX_KEYS and
      FUNC_MAX_ARGS have the same value.  INDEX_MAX_KEYS is still embedded
      in the on-disk representation (because it affects index tuple header
      size), but FUNC_MAX_ARGS is not.  I believe it would now be possible
      to increase FUNC_MAX_ARGS at little cost, but haven't experimented yet.
      There are still a lot of vestigial references to FUNC_MAX_ARGS, which
      I will clean up in a separate pass.  However, getting rid of it
      altogether would require changing the FunctionCallInfoData struct,
      and I'm not sure I want to buy into that.
      70c9763d
  11. 21 Mar, 2005 1 commit
    • Tom Lane's avatar
      Convert index-related tuple handling routines from char 'n'/' ' to bool · ee4ddac1
      Tom Lane authored
      convention for isnull flags.  Also, remove the useless InsertIndexResult
      return struct from index AM aminsert calls --- there is no reason for
      the caller to know where in the index the tuple was inserted, and we
      were wasting a palloc cycle per insert to deliver this uninteresting
      value (plus nontrivial complexity in some AMs).
      I forced initdb because of the change in the signature of the aminsert
      routines, even though nothing really looks at those pg_proc entries...
      ee4ddac1
  12. 20 Mar, 2005 1 commit
    • Tom Lane's avatar
      Remove unnecessary calls of FlushRelationBuffers: there is no need · 354049c7
      Tom Lane authored
      to write out data that we are about to tell the filesystem to drop.
      smgr_internal_unlink already had a DropRelFileNodeBuffers call to
      get rid of dead buffers without a write after it's no longer possible
      to roll back the deleting transaction.  Adding a similar call in
      smgrtruncate simplifies callers and makes the overall division of
      labor clearer.  This patch removes the former behavior that VACUUM
      would write all dirty buffers of a relation unconditionally.
      354049c7
  13. 16 Mar, 2005 1 commit
    • Tom Lane's avatar
      Revise TupleTableSlot code to avoid unnecessary construction and disassembly · f97aebd1
      Tom Lane authored
      of tuples when passing data up through multiple plan nodes.  A slot can now
      hold either a normal "physical" HeapTuple, or a "virtual" tuple consisting
      of Datum/isnull arrays.  Upper plan levels can usually just copy the Datum
      arrays, avoiding heap_formtuple() and possible subsequent nocachegetattr()
      calls to extract the data again.  This work extends Atsushi Ogawa's earlier
      patch, which provided the key idea of adding Datum arrays to TupleTableSlots.
      (I believe however that something like this was foreseen way back in Berkeley
      days --- see the old comment on ExecProject.)  A test case involving many
      levels of join of fairly wide tables (about 80 columns altogether) showed
      about 3x overall speedup, though simple queries will probably not be
      helped very much.
      
      I have also duplicated some code in heaptuple.c in order to provide versions
      of heap_formtuple and friends that use "bool" arrays to indicate null
      attributes, instead of the old convention of "char" arrays containing either
      'n' or ' '.  This provides a better match to the convention used by
      ExecEvalExpr.  While I have not made a concerted effort to get rid of uses
      of the old routines, I think they should be deprecated and eventually removed.
      f97aebd1
  14. 07 Mar, 2005 1 commit
  15. 04 Mar, 2005 1 commit
    • Tom Lane's avatar
      Replace the BufMgrLock with separate locks on the lookup hashtable and · 5d508736
      Tom Lane authored
      the freelist, plus per-buffer spinlocks that protect access to individual
      shared buffer headers.  This requires abandoning a global freelist (since
      the freelist is a global contention point), which shoots down ARC and 2Q
      as well as plain LRU management.  Adopt a clock sweep algorithm instead.
      Preliminary results show substantial improvement in multi-backend situations.
      5d508736
  16. 10 Jan, 2005 1 commit
  17. 31 Dec, 2004 1 commit
    • PostgreSQL Daemon's avatar
      · 2ff50159
      PostgreSQL Daemon authored
      Tag appropriate files for rc3
      
      Also performed an initial run through of upgrading our Copyright date to
      extend to 2005 ... first run here was very simple ... change everything
      where: grep 1996-2004 && the word 'Copyright' ... scanned through the
      generated list with 'less' first, and after, to make sure that I only
      picked up the right entries ...
      2ff50159
  18. 01 Dec, 2004 1 commit
    • Tom Lane's avatar
      Change planner to use the current true disk file size as its estimate of · 5374d097
      Tom Lane authored
      a relation's number of blocks, rather than the possibly-obsolete value
      in pg_class.relpages.  Scale the value in pg_class.reltuples correspondingly
      to arrive at a hopefully more accurate number of rows.  When pg_class
      contains 0/0, estimate a tuple width from the column datatypes and divide
      that into current file size to estimate number of rows.  This improved
      methodology allows us to jettison the ancient hacks that put bogus default
      values into pg_class when a table is first created.  Also, per a suggestion
      from Simon, make VACUUM (but not VACUUM FULL or ANALYZE) adjust the value
      it puts into pg_class.reltuples to try to represent the mean tuple density
      instead of the minimal density that actually prevails just after VACUUM.
      These changes alter the plans selected for certain regression tests, so
      update the expected files accordingly.  (I removed join_1.out because
      it's not clear if it still applies; we can add back any variant versions
      as they are shown to be needed.)
      5374d097
  19. 15 Oct, 2004 1 commit
  20. 01 Oct, 2004 1 commit
  21. 31 Aug, 2004 1 commit
  22. 29 Aug, 2004 2 commits
  23. 28 Aug, 2004 1 commit
    • Tom Lane's avatar
      Rearrange order of operations in heap_drop_with_catalog and index_drop · 448eb083
      Tom Lane authored
      so that we close and flush the doomed relation's relcache entry before
      we start to delete the underlying catalog rows, rather than afterwards.
      For awhile yesterday I thought that an unexpected relcache entry rebuild
      partway through this sequence might explain the infrequent parallel
      regression failures we were chasing.  It doesn't, mainly because there's
      no CommandCounterIncrement in the sequence and so the deletions aren't
      "really" done yet.  But it sure seems like trouble waiting to happen.
      448eb083
  24. 01 Aug, 2004 1 commit
    • Tom Lane's avatar
      Some mop-up work for savepoints (nested transactions). Store a small · efcaf1e8
      Tom Lane authored
      number of active subtransaction XIDs in each backend's PGPROC entry,
      and use this to avoid expensive probes into pg_subtrans during
      TransactionIdIsInProgress.  Extend EOXactCallback API to allow add-on
      modules to get control at subxact start/end.  (This is deliberately
      not compatible with the former API, since any uses of that API probably
      need manual review anyway.)  Add basic reference documentation for
      SAVEPOINT and related commands.  Minor other cleanups to check off some
      of the open issues for subtransactions.
      Alvaro Herrera and Tom Lane.
      efcaf1e8
  25. 18 Jun, 2004 1 commit
  26. 31 May, 2004 1 commit
    • Tom Lane's avatar
      Minor code rationalization: FlushRelationBuffers just returns void, · e6747079
      Tom Lane authored
      rather than an error code, and does elog(ERROR) not elog(WARNING)
      when it detects a problem.  All callers were simply elog(ERROR)'ing on
      failure return anyway, and I find it hard to envision a caller that would
      not, so we may as well simplify the callers and produce the more useful
      error message directly.
      e6747079
  27. 26 May, 2004 1 commit
    • Neil Conway's avatar
      Reimplement the linked list data structure used throughout the backend. · d0b4399d
      Neil Conway authored
      In the past, we used a 'Lispy' linked list implementation: a "list" was
      merely a pointer to the head node of the list. The problem with that
      design is that it makes lappend() and length() linear time. This patch
      fixes that problem (and others) by maintaining a count of the list
      length and a pointer to the tail node along with each head node pointer.
      A "list" is now a pointer to a structure containing some meta-data
      about the list; the head and tail pointers in that structure refer
      to ListCell structures that maintain the actual linked list of nodes.
      
      The function names of the list API have also been changed to, I hope,
      be more logically consistent. By default, the old function names are
      still available; they will be disabled-by-default once the rest of
      the tree has been updated to use the new API names.
      d0b4399d
  28. 08 May, 2004 2 commits
    • Tom Lane's avatar
      Get rid of rd_nblocks field in relcache entries. Turns out this was · 4af34211
      Tom Lane authored
      costing us lots more to maintain than it was worth.  On shared tables
      it was of exactly zero benefit because we couldn't trust it to be
      up to date.  On temp tables it sometimes saved an lseek, but not often
      enough to be worth getting excited about.  And the real problem was that
      we forced an lseek on every relcache flush in order to update the field.
      So all in all it seems best to lose the complexity.
      4af34211
    • Tom Lane's avatar
      Get rid of cluster.c's apparatus for rebuilding a relation's indexes · dd16b7aa
      Tom Lane authored
      in favor of using the REINDEX TABLE apparatus, which does the same thing
      simpler and faster.  Also, make TRUNCATE not use cluster.c at all, but
      just assign a new relfilenode and REINDEX.  This partially addresses
      Hartmut Raschick's complaint from last December that 7.4's TRUNCATE is
      an order of magnitude slower than prior releases.  By getting rid of
      a lot of unnecessary catalog updates, these changes buy back about a
      factor of two (on my system).  The remaining overhead seems associated
      with creating and deleting storage files, which we may not be able to
      do much about without abandoning transaction safety for TRUNCATE.
      dd16b7aa
  29. 05 May, 2004 1 commit
    • Tom Lane's avatar
      ALTER TABLE rewrite. New cool stuff: · 077db40f
      Tom Lane authored
      * ALTER ... ADD COLUMN with defaults and NOT NULL constraints works per SQL
      spec.  A default is implemented by rewriting the table with the new value
      stored in each row.
      
      * ALTER COLUMN TYPE.  You can change a column's datatype to anything you
      want, so long as you can specify how to convert the old value.  Rewrites
      the table.  (Possible future improvement: optimize no-op conversions such
      as varchar(N) to varchar(N+1).)
      
      * Multiple ALTER actions in a single ALTER TABLE command.  You can perform
      any number of column additions, type changes, and constraint additions with
      only one pass over the table contents.
      
      Basic documentation provided in ALTER TABLE ref page, but some more docs
      work is needed.
      
      Original patch from Rod Taylor, additional work from Tom Lane.
      077db40f
  30. 15 Feb, 2004 1 commit
    • Tom Lane's avatar
      First steps towards statistics on expressional (nee functional) indexes. · f0c9397f
      Tom Lane authored
      This commit teaches ANALYZE to store such stats in pg_statistic, but
      nothing is done yet about teaching the planner to use 'em.
      Also, repair longstanding oversight in separate ANALYZE command: it
      updated the pg_class.relpages and reltuples counts for the table proper,
      but not for indexes.
      f0c9397f
  31. 10 Feb, 2004 1 commit
    • Tom Lane's avatar
      Restructure smgr API as per recent proposal. smgr no longer depends on · 87bd9563
      Tom Lane authored
      the relcache, and so the notion of 'blind write' is gone.  This should
      improve efficiency in bgwriter and background checkpoint processes.
      Internal restructuring in md.c to remove the not-very-useful array of
      MdfdVec objects --- might as well just use pointers.
      Also remove the long-dead 'persistent main memory' storage manager (mm.c),
      since it seems quite unlikely to ever get resurrected.
      87bd9563
  32. 28 Jan, 2004 1 commit
    • Tom Lane's avatar
      Review uses of IsUnderPostmaster, change some tests to look at · 2f0d43b2
      Tom Lane authored
      whereToSendOutput instead because they are really inquiring about
      the correct client communication protocol.  Update some comments.
      This is pointing towards supporting regular FE/BE client protocol
      in a standalone backend, per discussion a month or so back.
      2f0d43b2
  33. 07 Jan, 2004 1 commit
  34. 28 Dec, 2003 1 commit
    • Tom Lane's avatar
      Clean up the usage of canonicalize_qual(): in particular, be consistent · c607bd69
      Tom Lane authored
      about whether it is applied before or after eval_const_expressions().
      I believe there were some corner cases where the system would fail to
      recognize that a partial index is applicable because of the previous
      inconsistency.  Store normal rather than 'implicit AND' representations
      of constraints and index predicates in the catalogs.
      initdb forced due to representation change of constraints/predicates.
      c607bd69
  35. 29 Nov, 2003 1 commit
    • PostgreSQL Daemon's avatar
      · 969685ad
      PostgreSQL Daemon authored
      $Header: -> $PostgreSQL Changes ...
      969685ad
  36. 19 Nov, 2003 1 commit
    • Jan Wieck's avatar
      Background writer process · cfeca621
      Jan Wieck authored
      This first part of the background writer does no syncing at all.
      It's only purpose is to keep the LRU heads clean so that regular
      backends seldom to never have to call write().
      
      Jan
      cfeca621
  37. 12 Nov, 2003 1 commit
    • Tom Lane's avatar
      Cross-data-type comparisons are now indexable by btrees, pursuant to my · fa5c8a05
      Tom Lane authored
      pghackers proposal of 8-Nov.  All the existing cross-type comparison
      operators (int2/int4/int8 and float4/float8) have appropriate support.
      The original proposal of storing the right-hand-side datatype as part of
      the primary key for pg_amop and pg_amproc got modified a bit in the event;
      it is easier to store zero as the 'default' case and only store a nonzero
      when the operator is actually cross-type.  Along the way, remove the
      long-since-defunct bigbox_ops operator class.
      fa5c8a05