Commit Graph

26372 Commits

Author SHA1 Message Date
Tom Lane 422495d0da Modify prefix_selectivity() so that it will never estimate the selectivity
of the generated range condition var >= 'foo' AND var < 'fop' as being less
than what eqsel() would estimate for var = 'foo'.  This is intuitively
reasonable and it gets rid of the need for some entirely ad-hoc coding we
formerly used to reject bogus estimates.  The basic problem here is that
if the prefix is more than a few characters long, the two boundary values
are too close together to be distinguishable by comparison to the column
histogram, resulting in a selectivity estimate of zero, which is often
not very sane.  Change motivated by an example from Peter Eisentraut.

Arguably this is a bug fix, but I'll refrain from back-patching it
for the moment.
2008-03-08 22:41:38 +00:00
Tom Lane 6f10eb2111 Refactor heap_page_prune so that instead of changing item states on-the-fly,
it accumulates the set of changes to be made and then applies them.  It had
to accumulate the set of changes anyway to prepare a WAL record for the
pruning action, so this isn't an enormous change; the only new complexity is
to not doubly mark tuples that are visited twice in the scan.  The main
advantage is that we can substantially reduce the scope of the critical
section in which the changes are applied, thus avoiding PANIC in foreseeable
cases like running out of memory in inval.c.  A nice secondary advantage is
that it is now far clearer that WAL replay will actually do the same thing
that the original pruning did.

This commit doesn't do anything about the open problem that
CacheInvalidateHeapTuple doesn't have the right semantics for a CTID change
caused by collapsing out a redirect pointer.  But whatever we do about that,
it'll be a good idea to not do it inside a critical section.
2008-03-08 21:57:59 +00:00
Bruce Momjian cc05d051a6 Add:
>
> * Consider a function-based API for '@@' full text searches
>
>   http://archives.postgresql.org/pgsql-hackers/2007-11/msg00511.php
>
2008-03-08 17:57:21 +00:00
Andrew Dunstan 95c238d941 Improve efficiency of attribute scanning in CopyReadAttributesCSV.
The loop is split into two parts, inside quotes, and outside quotes, saving some instructions in both parts.

Heikki Linnakangas
2008-03-08 01:16:26 +00:00
Tom Lane 9c767ad57b Improve pglz_decompress() so that it cannot clobber memory beyond the
available output buffer when presented with corrupt input.  Some testing
suggests that this slows the decompression loop about 1%, which seems an
acceptable price to pay for more robustness.  (Curiously, the penalty
seems to be *less* on not-very-compressible data, which I didn't expect
since the overhead per output byte ought to be more in the literal-bytes
path.)

Patch from Zdenek Kotala.  I fixed a corner case and did some renaming
of variables to make the routine more readable.
2008-03-08 01:09:36 +00:00
Tom Lane ad434473eb This patch addresses some issues in TOAST compression strategy that
were discussed last year, but we felt it was too late in the 8.3 cycle to
change the code immediately.  Specifically, the patch:

* Reduces the minimum datum size to be considered for compression from
256 to 32 bytes, as suggested by Greg Stark.

* Increases the required compression rate for compressed storage from
20% to 25%, again per Greg's suggestion.

* Replaces force_input_size (size above which compression is forced)
with a maximum size to be considered for compression.  It was agreed
that allowing large inputs to escape the minimum-compression-rate
requirement was not bright, and that indeed we'd rather have a knob
that acted in the other direction.  I set this value to 1MB for the
moment, but it could use some performance studies to tune it.

* Adds an early-failure path to the compressor as suggested by Jan:
if it's been unable to find even one compressible substring in the
first 1KB (parameterizable), assume we're looking at incompressible
input and give up.  (Possibly this logic can be improved, but I'll
commit it as-is for now.)

* Improves the toasting heuristics so that when we have very large
fields with attstorage 'x' or 'e', we will push those out to toast
storage before considering inline compression of shorter fields.
This also responds to a suggestion of Greg's, though my original
proposal for a solution was a bit off base because it didn't fix
the problem for large 'e' fields.

There was some discussion in the earlier threads of exposing some
of the compression knobs to users, perhaps even on a per-column
basis.  I have not done anything about that here.  It seems to me
that if we are changing around the parameters, we'd better get some
experience and be sure we are happy with the design before we set
things in stone by providing user-visible knobs.
2008-03-07 23:20:21 +00:00
Bruce Momjian 1cc52905f0 Add:
>
> * Add a function like pg_get_indexdef() that report more detailed index
>   information
>
>   http://archives.postgresql.org/pgsql-bugs/2007-12/msg00166.php
>
2008-03-07 20:38:59 +00:00
Bruce Momjian f76eee0bf1 Add:
>
>
> 	o Prevent autovacuum from running if an old transaction is still
> 	  running from the last vacuum
>
> 	  http://archives.postgresql.org/pgsql-hackers/2007-11/msg00899.php
>
2008-03-07 20:22:25 +00:00
Bruce Momjian 0323f706b0 Added to TODO:
>
> * Allow text search dictionary to filter out only stop words
>
>   http://archives.postgresql.org/pgsql-patches/2007-11/msg00081.php
2008-03-07 20:06:03 +00:00
Bruce Momjian 090012131c Add to TODO:
>
> * Consider allowing higher priority queries to have referenced buffer
>   cache pages stay in memory longer
>
>   http://archives.postgresql.org/pgsql-hackers/2007-11/msg00562.php
2008-03-07 20:01:24 +00:00
Bruce Momjian 3310b3c144 Add:
>
> * Improve referential integrity checks
>
>   http://archives.postgresql.org/pgsql-performance/2005-10/msg00458.php
2008-03-07 19:18:59 +00:00
Bruce Momjian 4864986e94 Add item:
> 	o Store per-table autovacuum settings in pg_class.reloptions.
>
> 	  http://archives.postgresql.org/pgsql-hackers/2007-02/msg01440.php
> 	  http://archives.postgresql.org/pgsql-hackers/2008-01/msg00724.php
2008-03-07 19:03:39 +00:00
Bruce Momjian 3c361cbe57 Add URL for:
* Allow multiple identical NOTIFY events to always be communicated to the
  client, rather than sent as a single notification to the listener

  http://archives.postgresql.org/pgsql-general/2008-01/msg00057.php
2008-03-07 18:53:49 +00:00
Bruce Momjian 9d96b581d0 Add:
> 	o Add SQLSTATE severity to PGconn return status
>
> 	  http://archives.postgresql.org/pgsql-interfaces/2007-11/msg00015.php
2008-03-07 17:54:15 +00:00
Tom Lane 6a17826621 Change hashscan.c to keep its list of active hash index scans in
TopMemoryContext, rather than scattered through executor per-query contexts.
This poses no danger of memory leak since the ResourceOwner mechanism
guarantees release of no-longer-needed items.  It is needed because the
per-query context might already be released by the time we try to clean up
the hash scan list.  Report by ykhuang, diagnosis by Heikki.

Back-patch to 8.0, where the ResourceOwner-based cleanup was introduced.
The given test case does not fail before 8.2, probably because we rearranged
transaction abort processing somehow; but this coding is undoubtedly risky
so I'll patch 8.0 and 8.1 anyway.
2008-03-07 15:59:03 +00:00
Bruce Momjian b2facfd918 Add:
> 	o Have \l+ show database size, if permissions allow
>
> 	  Ideally it will not generate an error for invalid permissions
>
2008-03-07 15:56:40 +00:00
Bruce Momjian cbd08f6370 Add:
>
> * Add comments on system tables/columns using the information in
>   catalogs.sgml
>
>   Ideally the information would be pulled from the SGML file
>   automatically.
>
2008-03-07 14:57:39 +00:00
Teodor Sigaev 3b8bca335d Fix memory arrangement of tsquery after removing stop words. It causes
a unused memory holes in tsquery.

Per report by Richard Huxton <dev@archonet.com>.

It was working well because in fact tsquery->size is not used for any
kind of operation except comparing tsqueries. So, in HEAD it's enough to
fix to_tsquery function, but for previous version it's needed to
remove optimization in CompareTSQ to prevent requirement of renew all
stored tsquery.
2008-03-07 14:30:20 +00:00
Bruce Momjian 588d213a92 Clearify PITR doc wording. 2008-03-07 01:46:41 +00:00
Bruce Momjian 5490ccc033 Update wording:
< 	o Require all check constraints to be inherited
> 	o Require all CHECK constraints to be inherited
2008-03-07 01:06:55 +00:00
Bruce Momjian 86e39da9c6 Add:
>
> 	o Require all check constraints to be inherited
>
> 	  http://archives.postgresql.org/pgsql-bugs/2007-04/msg00026.php
2008-03-07 01:06:36 +00:00
Bruce Momjian 868d7e2643 Add:
> 	o Have \d show foreign keys that reference a table's primary key
>
> 	  http://archives.postgresql.org/pgsql-hackers/2007-04/msg00424.php
>
> 	o Have \d show child tables that inherit from the specified parent
2008-03-07 00:10:13 +00:00
Bruce Momjian 60fb7187d0 Add URL for:
* Consider compressing indexes by storing key values duplicated in
  several rows as a single index entry

>   http://archives.postgresql.org/pgsql-patches/2007-03/msg00163.php
2008-03-06 22:17:41 +00:00
Bruce Momjian cfc4d6ef11 Add URL for:
* Add SQL:2003 WITH RECURSIVE (hierarchical) queries to SELECT

>   http://archives.postgresql.org/pgsql-patches/2007-03/msg00139.php
2008-03-06 22:15:27 +00:00
Bruce Momjian 7afc827cf6 Add URLs for:
* Consider compressing indexes by storing key values duplicated in
  several rows as a single index entry
>
>   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00341.php
>   http://archives.postgresql.org/pgsql-hackers/2007-02/msg01264.php
>   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00465.php
>
2008-03-06 22:09:43 +00:00
Bruce Momjian 512775e2c6 Add URL for:
* Add SQL:2003 WITH RECURSIVE (hierarchical) queries to SELECT

>   http://archives.postgresql.org/pgsql-hackers/2007-01/msg01375.php
2008-03-06 22:04:57 +00:00
Bruce Momjian dc29472b74 Document that enabling asserts can _significantly_ slow down the server.
Back patch to 8.3.X.
2008-03-06 21:37:33 +00:00
Bruce Momjian 38ade59f95 Add:
>
> * Allow client certificate names to be checked against the client
>   hostname
>
>   This is already implemented in
>   libpq/fe-secure.c::verify_peer_name_matches_certificate() but the code
>   is commented out.
2008-03-06 21:25:50 +00:00
Bruce Momjian 2b70548bd4 Document use of pg_locks.objid for advisory locks, suggestion from Marc Mamin 2008-03-06 18:49:32 +00:00
Bruce Momjian 4f887c6bf0 Add:
>
> * Reduce memory usage of aggregates in set returning functions
>
>   http://archives.postgresql.org/pgsql-performance/2008-01/msg00031.php
>
2008-03-06 18:00:59 +00:00
Bruce Momjian 9772eb339d Add:
>
> 	o Prevent escape string warnings when object names have
> 	  backslashes
>
> 	  http://archives.postgresql.org/pgsql-hackers/2008-01/msg00227.php
>
2008-03-06 17:28:22 +00:00
Bruce Momjian 0083856e01 Add:
> * Prevent malicious functions from being executed with the permissions
>   of unsuspecting users
>
>   Index functions are safe, so VACUUM and ANALYZE are safe too.
>   Triggers, CHECK and DEFAULT expressions, and rules are still vulnerable.
>   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00268.php
2008-03-06 17:19:38 +00:00
Bruce Momjian 7ec66eab88 Improve "bgwriter_lru_multiplier" GUC description. 2008-03-06 16:31:42 +00:00
Bruce Momjian 51c3727903 Move client encoding libpq function docs into libpq doc section, and
just reference them from the localization doc section.

Backpatch to 8.3.X.
2008-03-06 15:37:56 +00:00
Bruce Momjian a4591abf37 Wording fix:
< 	o Have CONSTRAINT cname NOT NULL preserve the contraint name
> 	o Have CONSTRAINT cname NOT NULL record the contraint name
2008-03-06 03:22:32 +00:00
Bruce Momjian ecc5db57d5 Add:
>
> 	o Have CONSTRAINT cname NOT NULL preserve the contraint name
>
> 	  Right now pg_attribute.attnotnull records the NOT NULL status
> 	  of the column, but does not record the contraint name
>
2008-03-06 03:18:19 +00:00
Bruce Momjian fca7bcbb64 Break out referential integrity and server-side languages into separate
TODO categories.
2008-03-06 03:15:52 +00:00
Alvaro Herrera 4d436efca8 Clean up double negative, per Tom Lane. 2008-03-05 21:14:10 +00:00
Alvaro Herrera 8eb629aec6 Add support for dlopen on recent NetBSD/MIPS, per Rémi Zara. 2008-03-05 19:42:11 +00:00
Bruce Momjian 5b60c67bff Update libpqxx URL in top-level README, per Gurjeet Singh. 2008-03-05 17:04:24 +00:00
Tom Lane 649e856c33 In PrepareToInvalidateCacheTuple, don't force initialization of catalog
caches that we don't actually need to touch.  This saves some trivial
number of cycles and avoids certain cases of deadlock when doing concurrent
VACUUM FULL on system catalogs.  Per report from Gavin Roy.

Backpatch to 8.2.  In earlier versions, CatalogCacheInitializeCache didn't
lock the relation so there's no deadlock risk (though that certainly had
plenty of risks of its own).
2008-03-05 17:01:26 +00:00
Bruce Momjian 91215f6241 Document that increasing the number of checkpoints segments or
checkpoint timeout can incrase the time needed for crash recovery, per
suggestion from Simon.
2008-03-05 16:59:10 +00:00
Bruce Momjian 4309a7dd99 Add URL for:
* Add support for SQL-standard GENERATED/IDENTITY columns

>   http://archives.postgresql.org/pgsql-hackers/2008-02/msg00604.php
2008-03-05 16:07:21 +00:00
Bruce Momjian af79f03bdd Add URL for:
* Add SQL:2003 WITH RECURSIVE (hierarchical) queries to SELECT

>   http://archives.postgresql.org/pgsql-hackers/2008-02/msg00642.php
>
2008-03-05 16:02:31 +00:00
Bruce Momjian fd598416fc Add:
>
> 	o Allow COPY FROM to create index entries in bulk
>
> 	  http://archives.postgresql.org/pgsql-hackers/2008-02/msg00811.php
>
2008-03-05 15:56:11 +00:00
Bruce Momjian 910bc51862 When text search string is too long, in error message report actual and
maximum number of bytes allowed.
2008-03-05 15:50:37 +00:00
Tom Lane 0e50b080fa Include -lgss in libpq link, if available. Bjorn Munch 2008-03-05 05:39:11 +00:00
Tom Lane 7d6e6e2e97 Fix PREPARE TRANSACTION to reject the case where the transaction has dropped a
temporary table; we can't support that because there's no way to clean up the
source backend's internal state if the eventual COMMIT PREPARED is done by
another backend.  This was checked correctly in 8.1 but I broke it in 8.2 :-(.
Patch by Heikki Linnakangas, original trouble report by John Smith.
2008-03-04 19:54:06 +00:00
Magnus Hagander 9b8a93baa4 Use windows DACL fix for pg_regress as well.
Dave Page
2008-03-04 15:38:31 +00:00
Bruce Momjian 2c63d8405b Update pg_dump item:
< 	  produce a single dump output file.
> 	  produce a single dump output file.  It also would require
> 	  several sessions to share the same snapshot.
2008-03-04 14:38:38 +00:00