The data type(s) of the function's arguments, if any.
The input types may be base or complex types, or
opaque .
- o paque indicates that the function
+ O paque indicates that the function
accepts arguments of a non-SQL type such as char * .
The return data type.
The output type may be specified as a base type, complex type,
- setof type ,
+ setof type ,
or opaque .
The setof
modifier indicates that the function will return a set of items,
This form of the AS clause is used for
- dynamically- linked, C language functions when the function name in
+ dynamically linked, C language functions when the function name in
the C language source code is not the same as the name of the SQL
function. The string
class="parameter">obj_file is the name of the file
langname
- m ay be 'sql ',
+ M ay be 'sql ',
'C ', 'newC ',
'internal ', 'newinternal ',
or 'plname ',
iscachable
- i scachable indicates that the function always
+ I scachable indicates that the function always
returns the same result when given the same argument values (i.e.,
it does not do database lookups or otherwise use information not
directly present in its parameter list). The optimizer uses
The full
SQL92 type syntax is allowed for
input arguments and return value. However, some details of the
- type specification (e.g. the precision field for
+ type specification (e.g., the precision field for
numeric types) are the responsibility of the
underlying function implementation and are silently swallowed
(i.e., not recognized or
errors at link time. To get around that, give them different C names
(for example, use the argument types as part of the C names), then
specify those names in the AS clause of CREATE FUNCTION .
- If the AS clause is left empty then CREATE FUNCTION
+ If the AS clause is left empty, then CREATE FUNCTION
assumes the C name of the function is the same as the SQL name.
This example creates a function that does type conversion between the
- user defined type complex, and the internal type point. The
+ user- defined type complex, and the internal type point. The
function is implemented by a dynamically loaded object that was
compiled from C source. For
Postgres to
find a type conversion function automatically, the sql function has
bigbox_ops both support rtree indices on the
box data type.
The difference between them is that bigbox_ops
- scales box coordinates down, to avoid floating point exceptions from
+ scales box coordinates down, to avoid floating- point exceptions from
doing multiplication, addition, and subtraction on very large
floating-point coordinates. If the field on which your rectangles lie
is about 20,000 units square or larger, you should use
The call handler for a procedural language must be written
- in a compiled language such as 'C' and registered with
+ in a compiled language such as C and registered with
Postgres as a function taking
no arguments and returning the
opaque type, a placeholder for unspecified or undefined types.
pg_proc table entry. This may be the
source text in the procedural
language itself (like for PL/Tcl), a pathname to a
- file or anything else that tells the call handler what to
+ file, or anything else that tells the call handler what to
do in detail.
Usage
- This is a template for a PL handler written in 'C' :
+ This is a template for a PL handler written in C :
#include "executor/spi.h"
#include "commands/trigger.h"
Any SQL WHERE clause, new or
- old can appear instead of an instance
+ old , can appear instead of an instance
variable whenever an instance variable is permissible in SQL.
Any SQL statement, new or
- old can appear instead of an instance
+ old , can appear instead of an instance
variable whenever an instance variable is permissible in SQL.
The semantics of a rule is that at the time an individual instance is
- accessed, inserted, updated, or deleted, there is a old instance (for
+ accessed, inserted, updated, or deleted, there is an old instance (for
selects, updates and deletes) and a new instance (for inserts and
updates).
If the event
condition part of the rule
occurs. Alternately, the
action part will be done
- instead of the user command. In this later case, the
+ instead of the user command. In this latt er case, the
action can be the keyword
NOTHING .
The CACHE cache option
enables sequence numbers to be preallocated
and stored in memory for faster access. The minimum
- value is 1 (only one value can be generated at a time, i.e. no cache)
+ value is 1 (only one value can be generated at a time, i.e., no cache)
and this is also the default.
PRIMARY KEY clause may be specified for a table;
PRIMARY KEY column (a table
constraint) and PRIMARY KEY (a column constraint)
- are mutually exclusive.. See the table constraint clause for
+ are mutually exclusive. See the table constraint clause for
more information.
ERROR: Relation 'table ' already exists
- which occurs at runtime, if the table specified already exists
+ , which occurs at runtime if the table specified already exists
in the database.
NOT NULL constraint, does not violate a UNIQUE constraint. (This
deviates from the
SQL92 definition, but is a
more sensible convention. See the section on compatibility for more
- details.).
+ details.)
Each UNIQUE column constraint must name a column that is
- This occurs at run- time if one tries to insert a duplicate value into
+ This occurs at runtime if one tries to insert a duplicate value into
a column subject to a PRIMARY KEY constraint.
Postgres automatically creates
a unique index to assure
- data integrity. (See CREATE INDEX statement)
+ data integrity (see CREATE INDEX statement).
The PRIMARY KEY constraint should name a set of columns that is
values in a referenced column of a referenced table.
- A value added to this column are matched against the values of the
+ A value added to this column is matched against the values of the
referenced table and referenced column using the given match type.
In addition, when the referenced column data is changed, actions
are run upon this column's matching data.
Description
The PRIMARY KEY constraint specifies a rule that a group of one
- or more distinct columns of a table may contain only unique,
- (non duplicate), non-null values. The column definitions of
+ or more distinct columns of a table may contain only unique
+ (nonduplicate), non-null values. The column definitions of
the specified columns do not have to include a NOT NULL
constraint to be included in a PRIMARY KEY constraint.
default match type if none is specified. MATCH FULL will not
allow one column of a multi-column foreign key to be NULL
unless all foreign key columns are NULL. The default MATCH type
- allows a some foreign key columns to be NULL while other parts
+ allows some foreign key columns to be NULL while other parts
of the foreign key are not NULL. MATCH PARTIAL is currently not
supported.
Description
The FOREIGN KEY constraint specifies a rule that a group of one
- or more distinct columns of a table are related to a group
+ or more distinct columns of a table is related to a group
of distinct columns in the referenced table.
SQL92
- In addition to the locally- visible temporary table, SQL92 also defines a
+ In addition to the locally visible temporary table, SQL92 also defines a
CREATE GLOBAL TEMPORARY TABLE statement, and optionally an
ON COMMIT clause:
- An assertion is a special type of integrity constraint and share
+ An assertion is a special type of integrity constraint and shares
the same namespace as other constraints. However, an assertion is
not necessarily dependent on one particular base table as
constraints are, so SQL-92 provides the CREATE ASSERTION statement
-
- SET CONSTRAINT changes the foreign key constraint mode only for
- the current transaction.
+ SET CONSTRAINT changes the foreign key constraint mode
+ only for the current transaction.
+
INITIALLY IMMEDIATE
operation is attempted on a tuple (before constraints
are checked and the INSERT , UPDATE or
DELETE is attempted) or
- AFTER the operation has been attempted (e.g. after constraints
+ AFTER the operation has been attempted (e.g., after constraints
are checked and the INSERT ,
UPDATE or DELETE has
completed). If the
in which case Postgres assumes that the new type has the
same format
as the Postgres-supplied data type, "text ".
- To indicate that a type is variable- length, set
+ To indicate that a type is variable length, set
internallength
to VARIABLE .
The external representation is similarly specified using the
To indicate that a type is an array and to indicate that a
type has array elements, indicate the type of the array
element using the element keyword. For example, to define
- an array of 4 byte integers ("int4"), specify
+ an array of 4- byte integers ("int4"), specify
cursorname
- The name of the cursor to be used in subsequent FETCH operations..
+ The name of the cursor to be used in subsequent FETCH operations.
SQL92 keyword indicating that the cursor will be used
- in a readonly mode. Since this is the only cursor access mode
+ in a read only mode. Since this is the only cursor access mode
available in
Postgres this keyword has no effect.
and
Postgres does not resolve
byte ordering or representation issues for binary cursors.
Therefore, if your client machine and server machine use different
- representations (e.g. "big-endian" versus "little-endian"),
+ representations (e.g., "big-endian" versus "little-endian"),
you will probably not want your data returned in
binary format.
However, binary cursors may be a
interactively.
SQL92 allows embedded or modular cursors to
update database information.
- All
Postgres cursors are readonly.
+ All
Postgres cursors are read
only.
The BINARY keyword is a
Postgres extension.
ERROR: dropdb: cannot be executed on an open database
- You cannot be connected to the the database your are about to remove.
+ You cannot be connected to the database your are about to remove.
Instead, you could connect to template1 or any other
database and run this command again.
- This message occurs if the specified left unary operator
+ This message occurs if the left unary operator
specified does not exist.
- This message occurs if the specified right unary operator
+ This message occurs if the right unary operator
specified does not exist.
- Message returned if successfully .
+ Message returned if successful.
from C statements, sqlca (which includes the sqlca.h
header file) MUST be lowercase. This is because the EXEC SQL
prefix indicates that this INCLUDE will be parsed by ecpg.
- ecpg observes case sensitivity (SQLCA.h will not be found.)
+ ecpg observes case sensitivity (SQLCA.h will not be found).
EXEC SQL INCLUDE
can be used to include other header files
as long as case sensitivity is observed.
This command displays the execution plan that the Postgres planner
generates for the supplied query. The execution plan shows how
- the table(s) referenced by the query will be scanned --- by plain
- sequential scan, index scan etc --- and if multiple tables are
+ the table(s) referenced by the query will be scanned--- by plain
+ sequential scan, index scan, etc.--- and if multiple tables are
referenced, what join algorithms will be used to bring together
the required tuples from each input table.
selector
- defines the fetch direction. It can be one
+ defines the fetch direction. It can be one of
the following:
#
- A signed integer that specify how many rows to fetch.
+ A signed integer that specifies how many rows to fetch.
Note that a negative integer is equivalent to changing the sense of
FORWARD and BACKWARD.
SQL92 allows one to repetitively retrieve the cursor
at its "current position" using the syntax
-FETCH RELATIVE 0 FROM cursor
+FETCH RELATIVE 0 FROM cursor .
Postgres does not currently support
this notion; in fact the value zero is reserved to indicate that
all rows should be retrieved and is equivalent to specifying the ALL keyword.
- If the RELATIVE keyword has been used,
the Postgres
+ If the RELATIVE keyword has been used,
Postgres
assumes that the user intended
SQL92 behavior
and returns this error message.
The following examples traverses a table using a cursor.
--- s et up and use a cursor:
+-- S et up and use a cursor:
BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;
- The name of a user to whom grant privileges. PUBLIC is a short form
+ The name of a user to whom to grant privileges. PUBLIC is a short form
representing all users.
Currently, to grant privileges in
Postgres
- to only few columns, you must
+ to only a few columns, you must
create a view having desired columns and then grant privileges
to that view.
- Fields are compatible with th
e th ose in the
Postgres
+ Fields are compatible with those in the
Postgres
implementation, with the following additions:
- determines that error prevent it from completely creating the database
+ determines that an error prevented it from completely creating the database
system, it removes any files it may have created before determining
that it can't finish the job. This option inhibits any tidying-up and is
thus useful for debugging.
database. When you create a new database, everything in the
template1 database is copied.
It contains catalog tables filled in for things like the
- builtin types.
+ built- in types.
because you cannot run the database server as root either, but the
server needs to have access to the files
initdb
creates. Furthermore, during the initialization phase, when there are no
- users and no access controls installed, postgres will only connect with
+ users and no access controls installed,
Postgres
+ will only connect with
the name of the current Unix user, so you must log in under the account
that will own the server process.
In order to use this command you must be logged in (using 'su', for example)
- the database superuser.
+ as the database superuser.
INSERT allows one to insert new rows into a
class or table. One can insert
- a single row at time or several rows as a result of a query.
+ a single row at a time or several rows as a result of a query.
The columns in the target list may be listed in any order.
is running, the shared memory and semaphores allocated by the
will be deleted. This will result in a general failure of the
- backends servers started by that
+ backend servers started by that
Automatically acquired by SELECT...FOR UPDATE .
- While it is a shared lock, may be upgrade later to a ROW EXCLUSIVE lock.
+ While it is a shared lock, may be upgraded later to a ROW EXCLUSIVE lock.
This lock mode is also acquired by an unqualified
- LOCK TABLE (i.e. the command without an explicit
+ LOCK TABLE (i.e., the command without an explicit
lock mode option).
for the duration of a transaction.
Postgres always uses the least restrictive
lock mode whenever possible. LOCK TABLE
- provided for cases when you might need more restrictive locking.
+ provides for cases when you might need more restrictive locking.
To read data in their real current state when running a transaction
at the SERIALIZABLE isolation level you have to execute a LOCK TABLE
- statement before execution any DML statement, when the transaction defines
+ statement before executing any DML statement, when the transaction defines
what concurrent changes will be visible to itself.
In addition to the requirements above, if a transaction is going to
- change data in a table then SHARE ROW EXCLUSIVE lock mode should
+ change data in a table, then SHARE ROW EXCLUSIVE lock mode should
be acquired to prevent deadlock conditions when two concurrent
transactions attempt to lock the table in SHARE mode and then
try to change data in this table, both (implicitly) acquiring
- ROW EXCLUSIVE lock mode that conflicts with concurrent SHARE lock.
+ ROW EXCLUSIVE lock mode that conflicts with a concurrent SHARE lock.
- To continue with the deadlock (when two transaction wait one another)
+ To continue with the deadlock (when two transaction wait for one another)
issue raised above, you should follow two general rules to prevent
deadlock conditions:
Transactions should acquire two conflicting lock modes only if
- one of them is self-conflicting (i.e. may be held by one
+ one of them is self-conflicting (i.e., may be held by one
transaction at time only). If multiple lock modes are involved,
then transactions should always acquire the most restrictive mode first.
the notify event will not be delivered to its connected frontend until just
after the transaction is completed (either committed or aborted). Again, the
reasoning is that if a notify were delivered within a transaction that was
- later aborted, one would want the notification to be undone somehow --- but
+ later aborted, one would want the notification to be undone somehow--- but
the backend cannot "take back" a notify once it has sent it to the frontend.
So notify events are only delivered between transactions. The upshot of this
is that applications using NOTIFY for real-time signaling
It is common for a frontend that sends NOTIFY to be
listening on the same notify name itself. In that case it will get back a
notify event, just like all the other listening frontends. Depending on the
- application logic, this could result in useless work --- for example,
+ application logic, this could result in useless work--- for example,
re-reading a database table to find the same updates that that frontend just
wrote out. In
Postgres 6.4 and later, it is
possible to avoid such extra work by noticing whether the notifying backend
-
+_ctl">
-
+ _ctl-title">
Application
-w
- Wait for the database server comes up, by
+ Wait for the database server to come up, by
watching for creation of the pid file (PGDATA/postmaster.pid).
Times out after 60 seconds.
- The parameters are usually surrounded by single- or double
+ The parameters are usually surrounded by single or double
quotes to ensure that they are passed through as a group.
f
- Fast mode sends SIGTERM to the backends, that means
+ Fast mode sends SIGTERM to the backends; that means
active transactions get rolled back.
- If -w is supplied, pg_ctl waits for the database server comes up, by
+ If -w is supplied, pg_ctl waits for the database server to come up, by
watching for creation of the pid file (PGDATA/postmaster.pid), for up
to 60 seconds.
-w , -D , -m ,
-fast , -immediate and
-o
- can also be used in the restarting mode and they have same meanings as
+ can also be used in the restarting mode and they have the same meanings as
described above.
-c
- Clean(drop) schema prior to create.
+ Clean (drop) schema prior to create.
-v
- Specifies verbose mode
+ Specifies verbose mode.
Specifies the hostname of the machine on which the
is running. Defaults to using a local Unix domain socket
- rather than an IP connection..
+ rather than an IP connection.
-v
- Specifies verbose mode
+ Specifies verbose mode.
- Opens any database on a specified host at the specified port,
+ Open any database on a specified host at the specified port,
username and password.
- Saves preferences in ~/.pgaccessrc file.
+ Save preferences in ~/.pgaccessrc file.
- Execute with optional user input parameters; e.g.
+ Execute with optional user input parameters; e.g.,
select * from invoices where year=[parameter "Year of selection"]
-
+ .
Indicates to the backend server that it has been started by a
- and make different assumptions about buffer pool management, file
+ and makes different assumptions about buffer pool management, file
descriptors, etc. Switches following -p are restricted to those
considered "secure".
environment variable, or if PGPORT
is not set, then defaults to the value established when Postgres was
compiled (normally 5432). If you specify a port other than the
- default port then all frontend applications (including
+ default port, then all frontend applications (including
psql ) must specify the same
port using either command-line options or
PGPORT .
If an argument is found that does not belong to any option it will be interpreted
as the database name (or the user name, if the database name is also
given). Not all these options are required, defaults do apply.
- If you omit the host name psql will connect via a UNIX domain socket
+ If you omit the host name psql will connect via a Unix domain socket
to a server on the
local host. The default port number is compile-time determined. Since the database
server uses the same default, you will not have to specify the port in most
The format of a
psql command is the backslash,
followed immediately by a command verb, then any arguments. The arguments
- are separated from the command verb and each other by any number of white
- space characters.
+ are separated from the command verb and each other by any number of
+ white space characters.
- If the connection attempt failed (wrong username, access denied, etc.) the
+ If the connection attempt failed (wrong username, access denied, etc.), the
previous connection will be kept if and only if
psql is
in interactive mode. When executing a non-interactive script, processing
will immediately stop with an error. This distinction was chosen as a user
If pattern
(a regular expression) is specified, only matching functions are shown.
If the form \df+ is used, additional information about
- each function, including language and description is shown.
+ each function, including language and description, is shown.
If pattern is specified,
- it is a regular expression restricts the listing to those objects
+ it is a regular expression that restricts the listing to those objects
whose name matches. If one appends a +
to the command name,
each object is listed with its associated description, if any.
Saves future query results to the file
- filename or pipe future
+ filename or pipes future
results into a separate Unix shell to execute
command .
If no arguments are specified, the query output will be reset to
\?
- Get help information about the slash (\
) commands.
+ Get help information about the back slash (\
) commands.
Use the file filename
as the source of queries instead of reading queries interactively.
After the file is processed,
psql terminates.
- This in many ways equivalent to the internal command \i .
+ This is i n many ways equivalent to the internal command \i .
Using this option is subtly different from writing
documentation of the large object interface for more information.) Since
psql has no way to tell if you already
have a transaction in progress when you call one of its internal
- commands \lo_export , \lo_import ,
- \lo_unlink it must take some arbitrary action. This
+ commands ( \lo_export , \lo_import ,
+ \lo_unlink ) it must take some arbitrary action. This
action could either be to roll back any transaction that might already
be in progress, or to commit any such transaction, or to do nothing at
all. In the last case you must provide your own
A popular application of this facility is to refer to the last inserted
-
OID in subsequent statement to build a foreign key
+
OID in subsequent statement
s to build a foreign key
scenario.
Another possible use of this mechanism is to copy the contents of a file
into a field. First load the file into a variable and then proceed as above.
% digits
If digits starts with
- 0x the rest of the characters are interpreted at a
+ 0x the rest of the characters are interpreted as a
hexadecimal digit and the character with the corresponding code is
substituted. If the first digit is 0 the characters are
interpreted as on octal number and the corresponding character is
(4 rows)
- Notice how the int4 columns in right aligned while the text column in left aligned.
You can make this table look differently by using the \pset
command:
if you get strange messages, keep this in mind. For example
testdb=> \foo
-Field separator is "oo".
+Field separator is "oo",
- is perhaps not what one would expect.
+ which is perhaps not what one would expect.
REINDEX is used to recover corrupted system indexes.
- In order to run REINDEX command,Postmaster must be shut down and
+ In order to run REINDEX command, postmaster must be shut down and
stand-alone Postgres should be started instead with options -O and
- -P(an option to ignore system indexes). Note that we couldn't rely
+ -P (an option to ignore system indexes). Note that we couldn't rely
on system indexes for the recovery of system indexes.
If user1 gives a privilege WITH GRANT OPTION to user2,
- and user2 gives it to user3 then if user1 try revoke
- this privilege it fails if he/she specify the RESTRICT
+ and user2 gives it to user3, then if user1 tries revoke
+ this privilege it fails if he specify the RESTRICT
keyword.
where cond_op
can be one of: =, <, <=, >, >= or <>,
a conditional operator like ALL, ANY, IN, LIKE, or a
- locally- defined operator,
+ locally defined operator,
and log_op can be one
of: AND, OR, NOT.
SELECT will ignore all rows for which the WHERE condition does not return
When using LIMIT, it is a good idea to use an ORDER BY clause that
constrains the result rows into a unique order. Otherwise you will get
- an unpredictable subset of the query's rows --- you may be asking for
+ an unpredictable subset of the query's rows--- you may be asking for
the tenth through twentieth rows, but tenth through twentieth in what
ordering? You don't know what ordering, unless you specified ORDER BY.
TIMEZONE
- The possible values for timezone depends on your operating
+ The possible values for time zone depends on your operating
system. For example, on Linux
/usr/share/zoneinfo contains the database
of time zones.
- Here are some valid values for timezone:
+ Here are some valid values for time zone:
SET DATESTYLE TO Postgres,European;
- Set the timezone for Berkeley, California, using double quotes to
+ Set the time zone for Berkeley, California, using double quotes to
preserve the uppercase attributes of the time zone specifier (note
that the date/time format is ISO here):
1998-03-31 07:41:21-08
- Set the timezone for Italy (note the required single or double quotes to handle
+ Set the time zone for Italy (note the required single or double quotes to handle
the special characters):
- Acknowledge ment that statement has executed.
+ Acknowledgment that statement has executed.
classname
- needs not to be a valid class name but can be any string valid
+ need not be a valid class name but can be any string valid
as a name up to 32 characters long.
VACUUM ANALYZE collects statistics representing the
- disbu rsion of the data in each column.
+ dispe rsion of the data in each column.
This information is valuable when several query execution paths are possible.
Remove call to difftime() in timestamp support to fix SunOS(Bruce & Thomas)
Changes for Digital Unix
Portability fix for pg_dumpall(Bruce)
-Rename pg_attribute.attnvals to attdisbu rsion(Bruce)
+Rename pg_attribute.attnvals to attdispe rsion(Bruce)
"intro/unix" manual page now "pgintro"(Bruce)
"built-in" manual page now "pgbuiltin"(Bruce)
"drop" manual page now "drop_table"(Bruce)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.66 2000/07/03 23:09:10 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.67 2000/10/05 19:48:20 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
/*
* We do not need to check every single field here, and in fact
- * some fields such as attdisbu rsion probably shouldn't be
+ * some fields such as attdispe rsion probably shouldn't be
* compared.
*/
if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0)
MemSet(NameStr(att->attname), 0, NAMEDATALEN);
- att->attdisbu rsion = 0; /* dummy value */
+ att->attdispe rsion = 0; /* dummy value */
att->attcacheoff = -1;
att->atttypmod = typmod;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.146 2000/09/30 18:28:53 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.147 2000/10/05 19:48:21 momjian Exp $
*
*
* INTERFACE ROUTINES
* work? Is it automatic now? Expects the caller to have
* attname, atttypid, atttyparg, attproc, and attlen domains filled.
* Create fills the attnum domains sequentually from zero,
- * fills the attdisbu rsion domains with zeros, and fills the
+ * fills the attdispe rsion domains with zeros, and fills the
* attrelid fields with the relid.
*
* scan relation catalog for name conflict
for (i = 0; i < natts; i++)
{
(*dpp)->attrelid = new_rel_oid;
- (*dpp)->attdisbu rsion = 0;
+ (*dpp)->attdispe rsion = 0;
tup = heap_addheader(Natts_pg_attribute,
ATTRIBUTE_TUPLE_SIZE,
for (i = 0; i < -1 - FirstLowInvalidHeapAttributeNumber; i++)
{
(*dpp)->attrelid = new_rel_oid;
- /* (*dpp)->attdisbu rsion = 0; unneeded */
+ /* (*dpp)->attdispe rsion = 0; unneeded */
tup = heap_addheader(Natts_pg_attribute,
ATTRIBUTE_TUPLE_SIZE,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.126 2000/07/14 22:17:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.127 2000/10/05 19:48:21 momjian Exp $
*
*
* INTERFACE ROUTINES
*/
((Form_pg_attribute) to)->attnum = i + 1;
- ((Form_pg_attribute) to)->attdisbu rsion = 0.0;
+ ((Form_pg_attribute) to)->attdispe rsion = 0.0;
((Form_pg_attribute) to)->attnotnull = false;
((Form_pg_attribute) to)->atthasdef = false;
((Form_pg_attribute) to)->attcacheoff = -1;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.6 2000/09/06 14:15:16 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.7 2000/10/05 19:48:22 momjian Exp $
*
*-------------------------------------------------------------------------
float4 selratio; /* average ratio of rows selected
* for a random constant */
- /* Compute disbu rsion */
+ /* Compute dispe rsion */
if (stats->nonnull_cnt == 0 && stats->null_cnt == 0)
{
/*
* empty relation, so put a dummy value in
- * attdisbu rsion
+ * attdispe rsion
*/
selratio = 0;
}
* looks like we have a unique-key attribute --- flag
* this with special -1.0 flag value.
*
- * The correct disbu rsion is 1.0/numberOfRows, but since
+ * The correct dispe rsion is 1.0/numberOfRows, but since
* the relation row count can get updated without
- * recomputing disbu rsion, we want to store a
+ * recomputing dispe rsion, we want to store a
* "symbolic" value and figure 1.0/numberOfRows on the
* fly.
*/
}
/* overwrite the existing statistics in the tuple */
- attp->attdisbu rsion = selratio;
+ attp->attdispe rsion = selratio;
/* invalidate the tuple in the cache and write the buffer */
RelationInvalidateHeapTuple(ad, atup);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.104 2000/09/29 18:21:26 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.105 2000/10/05 19:48:22 momjian Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
namestrcpy(&(attribute->attname), colDef->colname);
attribute->atttypid = typeTuple->t_data->t_oid;
attribute->attlen = tform->typlen;
- attribute->attdisbu rsion = 0;
+ attribute->attdispe rsion = 0;
attribute->attcacheoff = -1;
attribute->atttypmod = colDef->typename->typmod;
attribute->attnum = i;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.166 2000/09/19 19:30:03 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.167 2000/10/05 19:48:22 momjian Exp $
*
*-------------------------------------------------------------------------
*
* Statistics are stored in several places: the pg_class row for the
* relation has stats about the whole relation, the pg_attribute rows
- * for each attribute store "disbu rsion", and there is a pg_statistic
- * row for each (non-system) attribute. (Disbu rsion probably ought to
+ * for each attribute store "dispe rsion", and there is a pg_statistic
+ * row for each (non-system) attribute. (Dispe rsion probably ought to
* be moved to pg_statistic, but it's not worth doing unless there's
- * another reason to have to change pg_attribute.) Disbu rsion and
+ * another reason to have to change pg_attribute.) Dispe rsion and
* pg_statistic values are only updated by VACUUM ANALYZE, but we
* always update the stats in pg_class.
*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.66 2000/09/12 21:06:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.67 2000/10/05 19:48:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
att->atttypid = typeID;
att->attdefrel = 0; /* dummy value */
- att->attdisbu rsion = 0; /* dummy value */
+ att->attdispe rsion = 0; /* dummy value */
att->atttyparg = 0; /* dummy value */
att->attlen = attLen;
att->attnum = attNum;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.63 2000/09/29 18:21:32 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.64 2000/10/05 19:48:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* 'outer_path' is the path for the outer relation
* 'inner_path' is the path for the inner relation
* 'restrictlist' are the RestrictInfo nodes to be applied at the join
- * 'innerdisbursion' is an estimate of the disbu rsion statistic
+ * 'innerdispersion' is an estimate of the dispe rsion statistic
* for the inner hash key.
*/
void
Path *outer_path,
Path *inner_path,
List *restrictlist,
- Selectivity innerdisbu rsion)
+ Selectivity innerdispe rsion)
{
Cost startup_cost = 0;
Cost run_cost = 0;
* average bucket loading of NTUP_PER_BUCKET, but that goal will
* be reached only if data values are uniformly distributed among
* the buckets. To be conservative, we scale up the target bucket
- * size by the number of inner rows times inner disbu rsion, giving
+ * size by the number of inner rows times inner dispe rsion, giving
* an estimate of the typical number of duplicates of each value.
* We then charge one cpu_operator_cost per tuple comparison.
*/
run_cost += cpu_operator_cost * outer_path->parent->rows *
- NTUP_PER_BUCKET * ceil(inner_path->parent->rows * innerdisbu rsion);
+ NTUP_PER_BUCKET * ceil(inner_path->parent->rows * innerdispe rsion);
/*
* Estimate the number of tuples that get through the hashing filter
/*
* Bias against putting larger relation on inside. We don't want an
* absolute prohibition, though, since larger relation might have
- * better disbu rsion --- and we can't trust the size estimates
+ * better dispe rsion --- and we can't trust the size estimates
* unreservedly, anyway. Instead, inflate the startup cost by the
* square root of the size ratio. (Why square root? No real good
* reason, but it seems reasonable...)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.57 2000/09/29 18:21:32 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.58 2000/10/05 19:48:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *restrictlist, JoinType jointype);
static Path *best_innerjoin(List *join_paths, List *outer_relid,
JoinType jointype);
-static Selectivity estimate_disbu rsion(Query *root, Var *var);
+static Selectivity estimate_dispe rsion(Query *root, Var *var);
static List *select_mergejoin_clauses(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
*right,
*inner;
List *hashclauses;
- Selectivity innerdisbu rsion;
+ Selectivity innerdispe rsion;
if (restrictinfo->hashjoinoperator == InvalidOid)
continue; /* not hashjoinable */
/* always a one-element list of hash clauses */
hashclauses = makeList1(restrictinfo);
- /* estimate disbu rsion of inner var for costing purposes */
- innerdisbursion = estimate_disbu rsion(root, inner);
+ /* estimate dispe rsion of inner var for costing purposes */
+ innerdispersion = estimate_dispe rsion(root, inner);
/*
* We consider both the cheapest-total-cost and
innerrel->cheapest_total_path,
restrictlist,
hashclauses,
- innerdisbu rsion));
+ innerdispe rsion));
if (outerrel->cheapest_startup_path != outerrel->cheapest_total_path)
add_path(joinrel, (Path *)
create_hashjoin_path(joinrel,
innerrel->cheapest_total_path,
restrictlist,
hashclauses,
- innerdisbu rsion));
+ innerdispe rsion));
}
}
}
/*
- * Estimate disbu rsion of the specified Var
+ * Estimate dispe rsion of the specified Var
*
* We use a default of 0.1 if we can't figure out anything better.
* This will typically discourage use of a hash rather strongly,
* seem much worse).
*/
static Selectivity
-estimate_disbu rsion(Query *root, Var *var)
+estimate_dispe rsion(Query *root, Var *var)
{
Oid relid;
if (relid == InvalidOid)
return 0.1;
- return (Selectivity) get_attdisbu rsion(relid, var->varattno, 0.1);
+ return (Selectivity) get_attdispe rsion(relid, var->varattno, 0.1);
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.66 2000/09/29 18:21:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.67 2000/10/05 19:48:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* 'restrict_clauses' are the RestrictInfo nodes to apply at the join
* 'hashclauses' is a list of the hash join clause (always a 1-element list)
* (this should be a subset of the restrict_clauses list)
- * 'innerdisbursion' is an estimate of the disbu rsion of the inner hash key
+ * 'innerdispersion' is an estimate of the dispe rsion of the inner hash key
*
*/
HashPath *
Path *inner_path,
List *restrict_clauses,
List *hashclauses,
- Selectivity innerdisbu rsion)
+ Selectivity innerdispe rsion)
{
HashPath *pathnode = makeNode(HashPath);
outer_path,
inner_path,
restrict_clauses,
- innerdisbu rsion);
+ innerdispe rsion);
return pathnode;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.79 2000/09/15 18:45:26 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.80 2000/10/05 19:48:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* No VACUUM ANALYZE stats available, so make a guess using
- * the disbu rsion stat (if we have that, which is unlikely for
+ * the dispe rsion stat (if we have that, which is unlikely for
* a normal attribute; but for a system attribute we may be
* able to estimate it).
*/
- selec = get_attdisbu rsion(relid, attno, 0.01);
+ selec = get_attdispe rsion(relid, attno, 0.01);
}
result = (float8) selec;
result = DEFAULT_EQ_SEL;
else
{
- num1 = unknown1 ? 1.0 : get_attdisbu rsion(relid1, attno1, 0.01);
- num2 = unknown2 ? 1.0 : get_attdisbu rsion(relid2, attno2, 0.01);
+ num1 = unknown1 ? 1.0 : get_attdispe rsion(relid1, attno1, 0.01);
+ num2 = unknown2 ? 1.0 : get_attdispe rsion(relid2, attno2, 0.01);
/*
* The join selectivity cannot be more than num2, since each tuple
* reasoning it is not more than num1. The min is therefore an
* upper bound.
*
- * If we know the disbu rsion of only one side, use it; the reasoning
+ * If we know the dispe rsion of only one side, use it; the reasoning
* above still works.
*
* XXX can we make a better estimate here? Using the nullfrac
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.45 2000/08/13 02:50:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.46 2000/10/05 19:48:29 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
}
/*
- * get_attdisbu rsion
+ * get_attdispe rsion
*
- * Retrieve the disbu rsion statistic for an attribute,
+ * Retrieve the dispe rsion statistic for an attribute,
* or produce an estimate if no info is available.
*
* min_estimate is the minimum estimate to return if insufficient data
* estimating the number of tuples produced by an equijoin.)
*/
double
-get_attdisbu rsion(Oid relid, AttrNumber attnum, double min_estimate)
+get_attdispe rsion(Oid relid, AttrNumber attnum, double min_estimate)
{
HeapTuple atp;
Form_pg_attribute att_tup;
- double disbu rsion;
+ double dispe rsion;
int32 ntuples;
atp = SearchSysCacheTuple(ATTNUM,
if (!HeapTupleIsValid(atp))
{
/* this should not happen */
- elog(ERROR, "get_attdisbu rsion: no attribute tuple %u %d",
+ elog(ERROR, "get_attdispe rsion: no attribute tuple %u %d",
relid, attnum);
return min_estimate;
}
att_tup = (Form_pg_attribute) GETSTRUCT(atp);
- disbursion = att_tup->attdisbu rsion;
- if (disbu rsion > 0.0)
- return disbu rsion; /* we have a specific estimate from VACUUM */
+ dispersion = att_tup->attdispe rsion;
+ if (dispe rsion > 0.0)
+ return dispe rsion; /* we have a specific estimate from VACUUM */
/*
- * Special-case boolean columns: the disbu rsion of a boolean is highly
+ * Special-case boolean columns: the dispe rsion of a boolean is highly
* unlikely to be anywhere near 1/numtuples, instead it's probably
* more like 0.5.
*
return 0.5;
/*
- * Disbursion is either 0 (no data available) or -1 (disbu rsion is
+ * Dispersion is either 0 (no data available) or -1 (dispe rsion is
* 1/numtuples). Either way, we need the relation size.
*/
if (!HeapTupleIsValid(atp))
{
/* this should not happen */
- elog(ERROR, "get_attdisbu rsion: no relation tuple %u", relid);
+ elog(ERROR, "get_attdispe rsion: no relation tuple %u", relid);
return min_estimate;
}
if (ntuples == 0)
return min_estimate; /* no data available */
- if (disbu rsion < 0.0) /* VACUUM thinks there are no duplicates */
+ if (dispe rsion < 0.0) /* VACUUM thinks there are no duplicates */
return 1.0 / (double) ntuples;
/*
- * VACUUM ANALYZE does not compute disbu rsion for system attributes,
+ * VACUUM ANALYZE does not compute dispe rsion for system attributes,
* but some of them can reasonably be assumed unique anyway.
*/
if (attnum == ObjectIdAttributeNumber ||
* = 1/numtuples. This may produce unreasonably small estimates for
* large tables, so limit the estimate to no less than min_estimate.
*/
- disbu rsion = 1.0 / (double) ntuples;
- if (disbu rsion < min_estimate)
- disbu rsion = min_estimate;
+ dispe rsion = 1.0 / (double) ntuples;
+ if (dispe rsion < min_estimate)
+ dispe rsion = min_estimate;
- return disbu rsion;
+ return dispe rsion;
}
/* ---------- INDEX CACHE ---------- */
Prints a detailed vacuum activity report for each table.
" {} "ANALYZE" {italic} "
- Updates column statistics used by the optimizer to determine the most efficient way to execute a query. The statistics represent the disbu rsion of the data in each column. This information is valuable when several execution paths are possible.
+ Updates column statistics used by the optimizer to determine the most efficient way to execute a query. The statistics represent the dispe rsion of the data in each column. This information is valuable when several execution paths are possible.
" {} "table" {italic} "
The name of a specific table to vacuum. Defaults to all tables.
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_attribute.h,v 1.63 2000/08/06 04:39:33 tgl Exp $
+ * $Id: pg_attribute.h,v 1.64 2000/10/05 19:48:31 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* Postgres will fail.
*/
- float4 attdisbu rsion;
+ float4 attdispe rsion;
/*
- * attdisbursion is the disbu rsion statistic of the column (0.0 to
+ * attdispersion is the dispe rsion statistic of the column (0.0 to
* 1.0), or zero if the statistic has not been calculated, or -1.0 if
* VACUUM found that the column contains no duplicate entries (in
- * which case the disbu rsion should be taken as 1.0/numberOfRows for
+ * which case the dispe rsion should be taken as 1.0/numberOfRows for
* the current table size). The -1.0 hack is useful because the
- * number of rows may be updated more often than attdisbu rsion is. We
+ * number of rows may be updated more often than attdispe rsion is. We
* assume that the column will retain its no-duplicate-entry property.
* (Perhaps this should be driven off the existence of a UNIQUE index
* for the column, instead of being a statistical guess?)
#define Anum_pg_attribute_attrelid 1
#define Anum_pg_attribute_attname 2
#define Anum_pg_attribute_atttypid 3
-#define Anum_pg_attribute_attdisbu rsion 4
+#define Anum_pg_attribute_attdispe rsion 4
#define Anum_pg_attribute_attlen 5
#define Anum_pg_attribute_attnum 6
#define Anum_pg_attribute_attnelems 7
{ 1249, {"attrelid"}, 26, 0, 4, 1, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0' }, \
{ 1249, {"attname"}, 19, 0, NAMEDATALEN, 2, 0, -1, -1, '\0', 'p', '\0', 'i', '\0', '\0' }, \
{ 1249, {"atttypid"}, 26, 0, 4, 3, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0' }, \
-{ 1249, {"attdisbu rsion"}, 700, 0, 4, 4, 0, -1, -1, '\0', 'p', '\0', 'i', '\0', '\0' }, \
+{ 1249, {"attdispe rsion"}, 700, 0, 4, 4, 0, -1, -1, '\0', 'p', '\0', 'i', '\0', '\0' }, \
{ 1249, {"attlen"}, 21, 0, 2, 5, 0, -1, -1, '\001', 'p', '\0', 's', '\0', '\0' }, \
{ 1249, {"attnum"}, 21, 0, 2, 6, 0, -1, -1, '\001', 'p', '\0', 's', '\0', '\0' }, \
{ 1249, {"attnelems"}, 23, 0, 4, 7, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0' }, \
DATA(insert OID = 0 ( 1249 attrelid 26 0 4 1 0 -1 -1 t p f i f f));
DATA(insert OID = 0 ( 1249 attname 19 0 NAMEDATALEN 2 0 -1 -1 f p f i f f));
DATA(insert OID = 0 ( 1249 atttypid 26 0 4 3 0 -1 -1 t p f i f f));
-DATA(insert OID = 0 ( 1249 attdisbu rsion 700 0 4 4 0 -1 -1 f p f i f f));
+DATA(insert OID = 0 ( 1249 attdispe rsion 700 0 4 4 0 -1 -1 f p f i f f));
DATA(insert OID = 0 ( 1249 attlen 21 0 2 5 0 -1 -1 t p f s f f));
DATA(insert OID = 0 ( 1249 attnum 21 0 2 6 0 -1 -1 t p f s f f));
DATA(insert OID = 0 ( 1249 attnelems 23 0 4 7 0 -1 -1 t p f i f f));
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: cost.h,v 1.34 2000/06/08 22:37:51 momjian Exp $
+ * $Id: cost.h,v 1.35 2000/10/05 19:48:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *restrictlist,
List *outersortkeys, List *innersortkeys);
extern void cost_hashjoin(Path *path, Path *outer_path, Path *inner_path,
- List *restrictlist, Selectivity innerdisbu rsion);
+ List *restrictlist, Selectivity innerdispe rsion);
extern Cost cost_qual_eval(List *quals);
extern void set_baserel_size_estimates(Query *root, RelOptInfo *rel);
extern void set_joinrel_size_estimates(Query *root, RelOptInfo *rel,
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pathnode.h,v 1.29 2000/09/29 18:21:40 tgl Exp $
+ * $Id: pathnode.h,v 1.30 2000/10/05 19:48:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Path *inner_path,
List *restrict_clauses,
List *hashclauses,
- Selectivity innerdisbu rsion);
+ Selectivity innerdispe rsion);
/*
* prototypes for relnode.c
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: lsyscache.h,v 1.25 2000/08/13 02:50:31 tgl Exp $
+ * $Id: lsyscache.h,v 1.26 2000/10/05 19:48:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern Oid get_atttype(Oid relid, AttrNumber attnum);
extern bool get_attisset(Oid relid, char *attname);
extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
-extern double get_attdisbu rsion(Oid relid, AttrNumber attnum,
+extern double get_attdispe rsion(Oid relid, AttrNumber attnum,
double min_estimate);
extern RegProcedure get_opcode(Oid opno);
extern char *get_opname(Oid opno);