1
1
2
2
Frequently Asked Questions (FAQ) for PostgreSQL
3
3
4
- Last updated: SatOct 24 00:12:23 EDT 1998
4
+ Last updated: SatDec 12 22:56:56 EST 1998
5
5
6
6
Current maintainer: Bruce Momjian (maillist@candle.pha.pa.us)
7
7
68
68
cursors?
69
69
3.5) What is an R-tree index and what is it used for?
70
70
3.6) What is the maximum size for a tuple?
71
- 3.7) I defined indices but my queries don't seem to make use of them.
72
- Why?
71
+ 3.7) My queries are slow or don't make use of the indexes. Why?
73
72
3.8) How do I do regular expression searches? case-insensitive regexp
74
73
searching?
75
74
3.9) I experienced a server crash during a vacuum. How do I remove the
@@ -275,7 +274,7 @@ Section 1: General Questions
275
274
pg_upgrade utility. Those upgrading from earlier releases require a
276
275
dump and restore.
277
276
278
- Thoseugrading from versions earlier than 1.09 must upgrade to 1.09
277
+ Thoseupgrading from versions earlier than 1.09 must upgrade to 1.09
279
278
first without a dump/reload, then dump the data from 1.09, and then
280
279
load it into 6.4.
281
280
@@ -306,14 +305,14 @@ Section 1: General Questions
306
305
PHP is great for simple stuff, but for more complex stuff, some still
307
306
use the perl interface and CGI.pm.
308
307
309
- An WWWgatway based on WDB using perl can be downloaded from
308
+ An WWWgateway based on WDB using perl can be downloaded from
310
309
http://www.eol.ists.ca/~dunlop/wdb-p95
311
310
312
311
1.13) Does PostgreSQL have a graphical user interface? A report generator? A
313
312
embedded query language interface?
314
313
315
314
We have a nice graphical user interface called pgaccess, which is
316
- shipped as part of thedistribtion . Pgaccess also has a report
315
+ shipped as part of thedistribution . Pgaccess also has a report
317
316
generator.
318
317
319
318
The web page is http://www.flex.ro/pgaccess We also include ecpg,
@@ -433,7 +432,7 @@ Section 2: Installation Questions
433
432
434
433
You can also use the postgres -S option to increase the maximum amount
435
434
of memory used by each backend process for temporary sorts. Each
436
- buffer is 1K and thedefualt is 512 buffers.
435
+ buffer is 1K and thedefault is 512 buffers.
437
436
438
437
You can also use the cluster command to group data in base tables to
439
438
match an index. See the cluster(l) manual page for more details.
@@ -471,7 +470,7 @@ Section 2: Installation Questions
471
470
operating system can attach to a running backend directly to diagnose
472
471
problems.
473
472
474
- The postgres program has a -s, -A, -t options that can be veryusefull
473
+ The postgres program has a -s, -A, -t options that can be veryuseful
475
474
for debugging and performance measurements.
476
475
477
476
You can also compile with profiling to see what functions are taking
@@ -483,7 +482,7 @@ Section 2: Installation Questions
483
482
484
483
Edit include/storage/sinvaladt.h, and change the value of
485
484
MaxBackendId. In the future, we plan to make this a configurable
486
- prameter .
485
+ parameter .
487
486
488
487
2.14) What non-unix ports are available?
489
488
@@ -492,12 +491,16 @@ Section 2: Installation Questions
492
491
the client is running on MS Windows, and communicates via TCP/IP to a
493
492
server running on one of our supported Unix platforms.
494
493
495
- A file win32.mak is included in thedistributiion for making a Win32
494
+ A file win32.mak is included in thedistribution for making a Win32
496
495
libpq library and psql.
497
496
498
- Someone is attempting to port our PostgreSQL database server to
499
- Windows NT using the Cygnus Unix/NT porting library. He has gotten it
500
- compiled, but initdb is currently failing.
497
+ The database server is now working on Windows NT using the Cygnus
498
+ Unix/NT porting library. The only feature missing is dynamic loading
499
+ of user-defined functions/types. See
500
+ http://www.askesis.nl/AskesisPostgresIndex.html for more information.
501
+
502
+ There is another port using U/Win at
503
+ http://surya.wipro.com/uwin/ported.html.
501
504
_________________________________________________________________
502
505
503
506
Section 3: PostgreSQL Features
@@ -569,22 +572,28 @@ Section 3: PostgreSQL Features
569
572
Tuples do not cross 8k boundaries so a 5k tuple will require 8k of
570
573
storage.
571
574
572
- 3.7)I defined indices but my queries don'tseem to make use ofthem . Why?
575
+ 3.7)My queries are slow or don't make use ofthe indexes . Why?
573
576
574
577
PostgreSQL does not automatically maintain statistics. One has to make
575
578
an explicit vacuum call to update the statistics. After statistics are
576
579
updated, the optimizer knows how many rows in the table, and can
577
580
better decide if it should use indices. Note that the optimizer does
578
- not use indices in cases when the table is small because a sequentail
579
- scan would be faster. For column-specific optimization statistics, use
580
- vacuum analyze.
581
+ not use indices in cases when the table is small because a sequential
582
+ scan would be faster.
583
+
584
+ For column-specific optimization statistics, use vacuum analyze.
585
+ Vacuum analyze is important for complex multi-join queries, so the
586
+ optimizer can estimate the number of rows returned from each table,
587
+ and choose the proper join order. The backend does not keep track of
588
+ column statistics on its own, and vacuum analyze must be run to
589
+ collect them periodically.
581
590
582
591
Indexes are not used for order by operations.
583
592
584
- When usingwildcard operators like LIKE or ~, indices can only be used
585
- if the beginning of the search is anchored to the start of the string.
586
- So, to use indices, LIKE searches can should not begin with %, and
587
- ~(regular expression searches) should start with ^.
593
+ When usingwild-card operators like LIKE or ~, indices can only be
594
+ used if the beginning of the search is anchored to the start of the
595
+ string. So, to use indices, LIKE searches can should not begin with %,
596
+ and ~(regular expression searches) should start with ^.
588
597
589
598
3.8) How do I do regular expression searches? case-insensitive regexp
590
599
searching?
@@ -681,9 +690,9 @@ BYTEA bytea variable-length array of bytes
681
690
CREATE TABLE new_table (mycol int);
682
691
INSERT INTO new_table SELECT oid, mycol FROM old_table;
683
692
684
- Tids are used toindentify specific physical rows with block and
685
- offset values. Tids change after rows are modified or reloaded. They
686
- are used by index entries to point to physical rows.
693
+ Tids are used toidentify specific physical rows with block and offset
694
+ values. Tids change after rows are modified or reloaded. They are used
695
+ by index entries to point to physical rows.
687
696
688
697
3.18) What is the meaning of some of the terms used in PostgreSQL?
689
698
@@ -794,10 +803,8 @@ Section 4: Extending PostgreSQL
794
803
4.2) I get messages of the type NOTICE:PortalHeapMemoryFree: 0x402251d0 not
795
804
in alloc set!
796
805
797
- You are pfree'ing something that was not palloc'ed. When writing
798
- user-defined functions, do not include the file "libpq-fe.h". Doing so
799
- will cause your palloc to be a malloc instead of a free. Then, when
800
- the backend pfrees the storage, you get the notice message.
806
+ You are pfree'ing something that was not palloc'ed. Beware of mixing
807
+ malloc/free and palloc/pfree.
801
808
802
809
4.3) I've written some nifty new types and functions for PostgreSQL.
803
810