1. 07 May, 2005 1 commit
    • Tom Lane's avatar
      Repair very-low-probability race condition between relation extension · 30f540be
      Tom Lane authored
      and VACUUM: in the interval between adding a new page to the relation
      and formatting it, it was possible for VACUUM to come along and decide
      it should format the page too.  Though not harmful in itself, this would
      cause data loss if a third transaction were able to insert tuples into
      the vacuumed page before the original extender got control back.
      30f540be
  2. 06 May, 2005 1 commit
  3. 27 Mar, 2005 1 commit
    • Tom Lane's avatar
      First steps towards index scans with heap access decoupled from index · bf3dbb58
      Tom Lane authored
      access: define new index access method functions 'amgetmulti' that can
      fetch multiple TIDs per call.  (The functions exist but are totally
      untested as yet.)  Since I was modifying pg_am anyway, remove the
      no-longer-needed 'rel' parameter from amcostestimate functions, and
      also remove the vestigial amowner column that was creating useless
      work for Alvaro's shared-object-dependencies project.
      Initdb forced due to changes in pg_am.
      bf3dbb58
  4. 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
  5. 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
  6. 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
  7. 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
  8. 17 Nov, 2004 1 commit
  9. 11 Nov, 2004 1 commit
  10. 29 Aug, 2004 1 commit
  11. 17 Jul, 2004 1 commit
    • Tom Lane's avatar
      Invent ResourceOwner mechanism as per my recent proposal, and use it to · fe548629
      Tom Lane authored
      keep track of portal-related resources separately from transaction-related
      resources.  This allows cursors to work in a somewhat sane fashion with
      nested transactions.  For now, cursor behavior is non-subtransactional,
      that is a cursor's state does not roll back if you abort a subtransaction
      that fetched from the cursor.  We might want to change that later.
      fe548629
  12. 05 Jun, 2004 1 commit
  13. 02 Jun, 2004 1 commit
    • Tom Lane's avatar
      Adjust btree index build to not use shared buffers, thereby avoiding the · 2095206d
      Tom Lane authored
      locking conflict against concurrent CHECKPOINT that was discussed a few
      weeks ago.  Also, if not using WAL archiving (which is always true ATM
      but won't be if PITR makes it into this release), there's no need to
      WAL-log the index build process; it's sufficient to force-fsync the
      completed index before commit.  This seems to gain about a factor of 2
      in my tests, which is consistent with writing half as much data.  I did
      not try it with WAL on a separate drive though --- probably the gain would
      be a lot less in that scenario.
      2095206d
  14. 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
  15. 08 May, 2004 1 commit
    • 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
  16. 21 Apr, 2004 1 commit
    • Tom Lane's avatar
      Tweak indexscan and seqscan code to arrange that steps from one page to · 37fa3b6c
      Tom Lane authored
      the next are handled by ReleaseAndReadBuffer rather than separate
      ReleaseBuffer and ReadBuffer calls.  This cuts the number of acquisitions
      of the BufMgrLock by a factor of 2 (possibly more, if an indexscan happens
      to pull successive rows from the same heap page).  Unfortunately this
      doesn't seem enough to get us out of the recently discussed context-switch
      storm problem, but it's surely worth doing anyway.
      37fa3b6c
  17. 10 Feb, 2004 2 commits
    • Tom Lane's avatar
      Centralize implementation of delay code by creating a pg_usleep() · 58f337a3
      Tom Lane authored
      subroutine in src/port/pgsleep.c.  Remove platform dependencies from
      miscadmin.h and put them in port.h where they belong.  Extend recent
      vacuum cost-based-delay patch to apply to VACUUM FULL, ANALYZE, and
      non-btree index vacuuming.
      
      By the way, where is the documentation for the cost-based-delay patch?
      58f337a3
    • 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
  18. 06 Feb, 2004 1 commit
  19. 03 Feb, 2004 1 commit
    • Tom Lane's avatar
      Rename SortMem and VacuumMem to work_mem and maintenance_work_mem. · 391c3811
      Tom Lane authored
      Make btree index creation and initial validation of foreign-key constraints
      use maintenance_work_mem rather than work_mem as their memory limit.
      Add some code to guc.c to allow these variables to be referenced by their
      old names in SHOW and SET commands, for backwards compatibility.
      391c3811
  20. 07 Jan, 2004 1 commit
  21. 29 Nov, 2003 1 commit
    • PostgreSQL Daemon's avatar
      · 969685ad
      PostgreSQL Daemon authored
      $Header: -> $PostgreSQL Changes ...
      969685ad
  22. 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
  23. 29 Sep, 2003 1 commit
    • Tom Lane's avatar
      Adjust btree index build procedure so that the btree metapage looks · e33f205a
      Tom Lane authored
      invalid (has the wrong magic number) until the build is entirely
      complete.  This turns out to cost no additional writes in the normal
      case, since we were rewriting the metapage at the end of the process
      anyway.  In normal scenarios there's no real gain in security, because
      a failed index build would roll back the transaction leaving an unused
      index file, but for rebuilding shared system indexes this seems to add
      some useful protection.
      e33f205a
  24. 04 Aug, 2003 2 commits
  25. 21 Jul, 2003 1 commit
  26. 23 Mar, 2003 1 commit
  27. 04 Mar, 2003 1 commit
    • Tom Lane's avatar
      Reimplement free-space-map management as per recent discussions. · 391eb5e5
      Tom Lane authored
      Adjustable threshold is gone in favor of keeping track of total requested
      page storage and doling out proportional fractions to each relation
      (with a minimum amount per relation, and some quantization of the results
      to avoid thrashing with small changes in page counts).  Provide special-
      case code for indexes so as not to waste space storing useless page
      free space counts.  Restructure internal data storage to be a flat array
      instead of list-of-chunks; this may cost a little more work in data
      copying when reorganizing, but allows binary search to be used during
      lookup_fsm_page_entry().
      391eb5e5
  28. 24 Feb, 2003 1 commit
  29. 23 Feb, 2003 3 commits
  30. 22 Feb, 2003 1 commit
    • Tom Lane's avatar
      More infrastructure for btree compaction project. Tree-traversal code · 799bc58d
      Tom Lane authored
      now knows what to do upon hitting a dead page (in theory anyway, it's
      untested...).  Add a post-VACUUM-cleanup entry point for index AMs, to
      provide a place for dead-page scavenging to happen.
      Also, fix oversight that broke btpo_prev links in temporary indexes.
      initdb forced due to additions in pg_am.
      799bc58d
  31. 21 Feb, 2003 1 commit
    • Tom Lane's avatar
      Make btree index structure adjustments and WAL logging changes needed to · 70508ba7
      Tom Lane authored
      support btree compaction, as per proposal of a few days ago.  btree index
      pages no longer store parent links, instead they have a level indicator
      (counting up from zero for leaf pages).  The FixBTree recovery logic is
      removed, and replaced by code that detects missing parent-level insertions
      during WAL replay.  Also, generate appropriate WAL entries when updating
      btree metapage and when building a btree index from scratch.  I believe
      btree indexes are now completely WAL-legal for the first time.
      initdb forced due to index and WAL changes.
      70508ba7
  32. 15 Nov, 2002 1 commit
  33. 20 Oct, 2002 1 commit
    • Tom Lane's avatar
      Fix potential problem with btbulkdelete deleting an indexscan's current · 13416a1f
      Tom Lane authored
      item, if the page containing the current item is split while the indexscan
      is stopped and holds no read-lock on the page.  The current item might
      move right onto a page that the indexscan holds no pin on.  In the prior
      code this would allow btbulkdelete to reach and possibly delete the item,
      causing 'my bits moved right off the end of the world!' when the indexscan
      finally resumes.  Fix by chaining read-locks to the right during
      _bt_restscan and requiring btbulkdelete to LockBufferForCleanup on every
      page it scans, not only those with deletable items.  Per my pghackers
      message of 25-May-02.  (Too bad no one could think of a better way.)
      13416a1f
  34. 04 Sep, 2002 1 commit
  35. 20 Jun, 2002 1 commit
  36. 24 May, 2002 1 commit
    • Tom Lane's avatar
      Mark index entries "killed" when they are no longer visible to any · 3f4d4880
      Tom Lane authored
      transaction, so as to avoid returning them out of the index AM.  Saves
      repeated heap_fetch operations on frequently-updated rows.  Also detect
      queries on unique keys (equality to all columns of a unique index), and
      don't bother continuing scan once we have found first match.
      
      Killing is implemented in the btree and hash AMs, but not yet in rtree
      or gist, because there isn't an equally convenient place to do it in
      those AMs (the outer amgetnext routine can't do it without re-pinning
      the index page).
      
      Did some small cleanup on APIs of HeapTupleSatisfies, heap_fetch, and
      index_insert to make this a little easier.
      3f4d4880