Tom Lane [Mon, 5 Jan 2004 18:04:39 +0000 (18:04 +0000)]
Improve UniquePath logic to detect the case where the input is already
known unique (eg, it is a SELECT DISTINCT ... subquery), and not do a
redundant unique-ification step.
Tom Lane [Mon, 5 Jan 2004 05:07:36 +0000 (05:07 +0000)]
Add the ability to extract OR indexscan conditions from OR-of-AND
join conditions in which each OR subclause includes a constraint on
the same relation. This implements the other useful side-effect of
conversion to CNF format, without its unpleasant side-effects. As
per pghackers discussion of a few weeks ago.
Tom Lane [Sun, 4 Jan 2004 05:57:21 +0000 (05:57 +0000)]
There's no longer any good reason for genbki.sh and Gen_fmgrtab.sh to
run the data through cpp, and we know of at least one platform where
unusual cpp behavior breaks the process. So remove the cpp step,
and make consequent simplifications.
Tom Lane [Sun, 4 Jan 2004 03:51:52 +0000 (03:51 +0000)]
Merge restrictlist_selectivity into clauselist_selectivity by
teaching the latter to accept either RestrictInfo nodes or bare
clause expressions; and cache the selectivity result in the RestrictInfo
node when possible. This extends the caching behavior of approx_selectivity
to many more contexts, and should reduce duplicate selectivity
calculations.
Tom Lane [Sun, 4 Jan 2004 00:07:32 +0000 (00:07 +0000)]
Rewrite OR indexscan processing to be more flexible. We can now for the
first time generate an OR indexscan for a two-column index when the WHERE
condition is like 'col1 = foo AND (col2 = bar OR col2 = baz)' --- before,
the OR had to be on the first column of the index or we'd not notice the
possibility of using it. Some progress towards extracting OR indexscans
from subclauses of an OR that references multiple relations, too, although
this code is #ifdef'd out because it needs more work.
Tom Lane [Thu, 1 Jan 2004 19:27:15 +0000 (19:27 +0000)]
Do an explicit fflush after writing a progress message with puts.
This ensures stdout is kept in sync with messages on stderr.
Per report from Olaf Ferger.
Tom Lane [Tue, 30 Dec 2003 23:53:15 +0000 (23:53 +0000)]
Adjust the definition of RestrictInfo's left_relids and right_relids
fields: now they are valid whenever the clause is a binary opclause,
not only when it is a potential join clause (there is a new boolean
field canjoin to signal the latter condition). This lets us avoid
recomputing the relid sets over and over while examining indexes.
Still more work to do to make this as useful as it could be, because
there are places that could use the info but don't have access to the
RestrictInfo node.
Tom Lane [Tue, 30 Dec 2003 21:49:19 +0000 (21:49 +0000)]
Instead of trying to force WHERE clauses into CNF or DNF normal form,
just look for common clauses that can be pulled out of ORs. Per recent
discussion, extracting common clauses seems to be the only really useful
effect of normalization, and if we do it explicitly then we can avoid
cluttering the qual with partially-redundant duplicated expressions, which
was an unpleasant side-effect of the old approach.
Tom Lane [Tue, 30 Dec 2003 20:05:05 +0000 (20:05 +0000)]
Avoid running out of memory during hash_create, by not passing a
number-of-buckets that exceeds the size we actually plan to allow
the hash table to grow to. Per trouble report from Sean Shanny.
Tom Lane [Tue, 30 Dec 2003 00:03:03 +0000 (00:03 +0000)]
ShmemInitHash forgot to specify HASH_ALLOC flag bit in its hash_create
call. You'd think this would cause some problems, but because of the
way hash_create is coded, the only side-effect was creation of a useless
memory context for the hashtable.
Tom Lane [Mon, 29 Dec 2003 23:54:22 +0000 (23:54 +0000)]
Use hash table name, not one-size-fits-all 'DynaHashTable', to identify
memory contexts belonging to hash tables. Makes the memory stats printout
a little more useful.
Tom Lane [Mon, 29 Dec 2003 22:22:45 +0000 (22:22 +0000)]
Using canonicalize_qual() to get rid of duplicate index predicate
conditions is overkill; set_union() does the job about as well, and
much more efficiently. Furthermore this avoids assuming that
canonicalize_qual() will check for duplicate clauses at all, which
it may not always do.
Tom Lane [Mon, 29 Dec 2003 21:33:09 +0000 (21:33 +0000)]
Tweak OpernameGetCandidates() to reduce palloc overhead --- profiling
showed that for common operator names such as '=', the pallocs done by
this routine occupied a surprisingly large fraction of the total time
for the parser to process an operator.
Tom Lane [Sun, 28 Dec 2003 21:57:37 +0000 (21:57 +0000)]
Clean up the usage of canonicalize_qual(): in particular, be consistent
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.
Tom Lane [Sat, 27 Dec 2003 20:58:58 +0000 (20:58 +0000)]
Improve spinlock code for recent x86 processors: insert a PAUSE
instruction in the s_lock() wait loop, and use test before test-and-set
in TAS() macro to avoid unnecessary bus traffic. Patch from Manfred
Spraul, reworked a bit by Tom.
Bruce Momjian [Thu, 25 Dec 2003 03:36:24 +0000 (03:36 +0000)]
> > I have no idea if this in Oracle or not. But it's something I
> > needed, and other people in the past asked about it too.
>
> It is in Oracle, but you aren't exactly on the spot. It should be
>
> IYYY - 4 digits ('2003')
> IYY - 3 digits ('003')
> IY - 2 digits ('03')
> I - 1 digit ('3')
Tom Lane [Tue, 23 Dec 2003 21:56:21 +0000 (21:56 +0000)]
Fix a number of places where reconfiguring with a different installation
prefix would fail, because the new path did not get propagated to where
it needed to be. Note this would fail even with --enable-depend.
Tom Lane [Tue, 23 Dec 2003 18:40:53 +0000 (18:40 +0000)]
Push responsibility for selecting out-of-line-assembler TAS code out to
the platform template files, instead of doing it directly in configure.in.
This seems cleaner, and also opens the door to making the choice be
dependent on the compiler being used.
Tom Lane [Tue, 23 Dec 2003 18:13:17 +0000 (18:13 +0000)]
Mop-up for HAS_TEST_AND_SET refactoring. Un-break two or three platforms
that were broken, try to make layout of s_lock.h entries consistent,
use HAVE_SPINLOCKS in preference to HAS_TEST_AND_SET everywhere outside
s_lock.h itself.
Bruce Momjian [Sun, 21 Dec 2003 04:34:36 +0000 (04:34 +0000)]
Back out:
> Attached is a patch that addressed all the discussed issues
> that did not break backward compatability, including the
> ability to output ISO-8601 compliant intervals by setting
> datestyle to iso8601basic.
Bruce Momjian [Sun, 21 Dec 2003 04:30:10 +0000 (04:30 +0000)]
[ This description should have been on the earlier fork/exec
commit, but I am adding it now so it is in CVS.]
The patch basically is a slight rearrangement of the code to allow
fork/exec on Unix, with the ultimate goal of doing CreateProcess on
Win32. The changes are:
o Write out postmaster global variables and per-backend
variables to be read by the exec'ed backend
o Mark some static variables as global when exec is used so
then can be dumped from postmaster.c, marked NON_EXEC_STATIC
o Remove value passing with -p now that we have per-backend
file
o Move some pointer storage out of shared memory for easier
dumping.
o Modified pgsql_temp directory cleanup to handle per-database
directories and the backend exec directory under datadir.
Tom Lane [Sun, 21 Dec 2003 01:23:06 +0000 (01:23 +0000)]
Improve btree's initial-positioning-strategy code so that we never need
to step more than one entry after descending the search tree to arrive at
the correct place to start the scan. This can improve the behavior
substantially when there are many entries equal to the chosen boundary
value. Per suggestion from Dmitry Tkach, 14-Jul-03.
Tom Lane [Sun, 21 Dec 2003 00:33:33 +0000 (00:33 +0000)]
The recent DUMMY_PROCS patch broke accounting for the number of semaphores
needed. This caused us to fail all the time on Darwin, and we'd fail for
some values of maxBackends on SysV-sema platforms, too.
Tom Lane [Sat, 20 Dec 2003 18:45:49 +0000 (18:45 +0000)]
Dept. of third thoughts: in fact, libpq should support SCM_CREDS challenge
even when HAVE_GETPEEREID is defined, else it will be unable to connect to
pre-7.4 backends that are using IDENT authentication.
Tom Lane [Sat, 20 Dec 2003 18:24:52 +0000 (18:24 +0000)]
Fix broken IDENT support for FreeBSD (appears to have been broken by
ill-considered conditional logic in getpeereid patch of 3-Dec-2002).
Per bug #1021.
Bruce Momjian [Sat, 20 Dec 2003 15:32:55 +0000 (15:32 +0000)]
In my mind there were two categories of open issues
a) ones that are 100% backward (such as the comment about
outputting this format)
and
b) ones that aren't (such as deprecating the current
postgresql shorthand of
'1Y1M'::interval = 1 year 1 minute
in favor of the ISO-8601
'P1Y1M'::interval = 1 year 1 month.
Attached is a patch that addressed all the discussed issues that
did not break backward compatability, including the ability to
output ISO-8601 compliant intervals by setting datestyle to
iso8601basic.
Interval values can now be written as ISO 8601 time intervals, using
the "Format with time-unit designators". This format always starts with
the character 'P', followed by a string of values followed
by single character time-unit designators. A 'T' separates the date and
time parts of the interval.
Bruce Momjian [Fri, 19 Dec 2003 23:29:15 +0000 (23:29 +0000)]
Supress ecpg thread test if configure didn't enable threads. Fix
tools/thread to run even if configure didn't enable threads because this
test is used before enabling threads for the OS.
Joe Conway [Fri, 19 Dec 2003 00:02:11 +0000 (00:02 +0000)]
Use a shutdown callback to ensure proper clean up when rescanning
partially-evaluated SRFs. Per report found here:
http://archives.postgresql.org/pgsql-general/2003-12/msg00851.php
Tom Lane [Thu, 18 Dec 2003 22:23:42 +0000 (22:23 +0000)]
Use a shutdown callback to clear setArgsValid in a FuncExprState that is
evaluating a set-valued function. This fixes some additional problems
with rescanning partially-evaluated SRFs.
Tom Lane [Thu, 18 Dec 2003 20:21:37 +0000 (20:21 +0000)]
Ensure set-returning functions in the targetlist of a plan node will be
shut down cleanly if the plan node is ReScanned before the SRFs are run
to completion. This fixes the problem for SQL-language functions, but
still need work on functions using the SRF_XXX() macros.
Peter Eisentraut [Thu, 18 Dec 2003 18:55:09 +0000 (18:55 +0000)]
Move Informix compatibility include files out of the way. compatlib.h
was integrated into ecpg_informix.h, the other ones go into their own
subdirectory that is automatically considered by the embedded preprocessor
when in Informix mode.
Bruce Momjian [Thu, 18 Dec 2003 03:46:45 +0000 (03:46 +0000)]
Here is the definition of relation_byte_size() in optimizer/path/costsize.c:
----------------------------------------------------------------------
/*
* relation_byte_size
* Estimate the storage space in bytes for a given number of tuples
* of a given width (size in bytes).
*/
static double
relation_byte_size(double tuples, int width)
{
return tuples * (MAXALIGN(width) + MAXALIGN(sizeof(HeapTupleData)));
}
Tom Lane [Thu, 18 Dec 2003 00:22:12 +0000 (00:22 +0000)]
Be a little smarter in group_clauses_by_indexkey_for_join: detect cases
where a joinclause is redundant with a restriction clause. Original coding
believed this was impossible and didn't need to be checked for, but that
was a thinko ...
Tom Lane [Wed, 17 Dec 2003 22:11:30 +0000 (22:11 +0000)]
information_schema.constraint_column_usage and key_column_usage should
not discriminate against system columns, since we support constraints on
system columns, and in fact constraints on OID are moderately useful.