diff options
| author | Bruce Momjian | 2003-07-24 00:53:57 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2003-07-24 00:53:57 +0000 |
| commit | 5a8e537441393a64ab22aa77dbf189baa5dd7e5d (patch) | |
| tree | 43d0305569d024ae7a3b7c2777b551409c3e2ba8 | |
| parent | 0878a5e277ee9f95538cb0f3f42f9ed9d7b0a09e (diff) | |
Add Hungarian/Turkish FAQ's to 7.3.4.
| -rw-r--r-- | doc/FAQ_hungarian | 1120 | ||||
| -rw-r--r-- | doc/FAQ_turkish | 709 | ||||
| -rw-r--r-- | doc/src/FAQ/FAQ.html | 4 | ||||
| -rw-r--r-- | doc/src/FAQ/FAQ_german.html | 8 | ||||
| -rw-r--r-- | doc/src/FAQ/FAQ_turkish.html | 1255 |
5 files changed, 3090 insertions, 6 deletions
diff --git a/doc/FAQ_hungarian b/doc/FAQ_hungarian new file mode 100644 index 00000000000..63603c07be5 --- /dev/null +++ b/doc/FAQ_hungarian @@ -0,0 +1,1120 @@ + + PostgreSQL GyIK + Utols� m�dos�t�s d�tuma: 2002 Okt 20. + Ford�t�s aktualiz�l�sa: 2003 janu�r + + A GyIK karbantart�ja: Bruce Momjian (pgman@candle.pha.pa.us) + Ford�t�: Horny�k L�szl� (hornyakl.NOSPAM@inf.elte.hu) + + A legfrissebb verzi� itt �rhet� el (angol): + http://www.PostgreSQL.org/docs/faq-english.html. + + Legfrissebb magyar nyelv� verzi�: + http://www.rootshell.be/~hornyakl/downloads/postgres_faq/ + + Platform specifikus k�rd�sek: + http://www.PostgreSQL.org/users-lounge/docs/faq.html. + _________________________________________________________________ + + �ltal�nos k�rd�sek + + 1.1) Mi a PostgreSQL? Hogy kell kimondani? + 1.2) Mik a PostgreSQL felhaszn�l�si felt�telei? + 1.3) Milyen UNIX oper�ci�s rendszereken fut PostgreSQL? + 1.4) Milyen nem UNIX oper�ci�s rendszerek el�rhet�ek? + 1.5) Hogyan tudok PostgreSQL-t szerezni? + 1.6) Hogyan kapok term�kt�mogat�st? + 1.7) Melyik a legfrissebb kiad�s? + 1.8) Milyen dokument�ci� �ll rendelkez�sre? + 1.9) Hogyan tal�lok inform�ci�t hib�kr�l vagy hi�nyz� funkcional�t�sr�l? + 1.10) Hogy tanuljam meg az SQL nyelvet? + 1.11) A PostgreSQL 2000. �v kompatibilis? + 1.12) Hogyan lehet csatlakozni a fejleszt� csapathoz? + 1.13) Hogyan k�ldjek hibajelent�st? + 1.14) Milyen a PostgreSQL m�s DBMS-ekkel �sszehasonl�tva? + 1.15) Hogyan tudom �zletileg segiteni a PostgreSQL-t? + + Felhaszn�l�i kliens k�rd�sek + + 2.1) Van ODBC meghajt� PostgreSQL-hez? + 2.2) Milyen eszk�z�k �llnak rendelkez�sre PostgreSQL Web fejleszt�sekhez? + 2.3) Van a PostgreSQL-hez grafikus felhaszn�l�i fel�let ? Riport + gener�tor? Be�gyazott lek�rdez� nyelv fel�let? + 2.4) Milyen programoz�si nyelvekkel lehet el�rni a PostgreSQL szervert? + + Adminisztr�ci�s k�rd�sek + + 3.1) Hogyan tudom a PostgreSQL-t /usr/local/pgsql -t�l elt�r� helyre + install�lni? + 3.2) AMikor elind�tom a postmaster-t, egy "Bad System Call"-t vagy core + dump-ot kapok. Mi�rt? + 3.3) Amikor megpr�b�lom inditani a postmaster-t, "IpcMemoryCreate" hib�kat + kapok. Mi�rt? + 3.4) Amikor megpr�b�lom inditani a postmaster-t, "IpcSemaphoreCreate" hib�kat + kapok. Mi�rt? + 3.5) Hogyan tudom kontroll�lni a m�s g�pekr�l �rkez� kapcsolat k�r�seket? + 3.6) Hogyan tudom nagyobb teljes�tm�nyre hangolni az adatb�zisomat? + 3.7) Milyen hibakeres� lehet�s�gek �rhet�ek el? + 3.8) Mi�rt kapok "Sorry, too many clients" hib�t csatlakoz�sn�l? + 3.9) Mi van pgsql_tmp k�nyvt�rban? + 3.10) Mi�rt kell dumpolni �s �jrat�lteni PostgreSQL kiad�s v�lt�s�n�l? + + M�k�dtet�si k�rd�sek + + 4.1) Mi a k�l�nbs�g a bin�ris �s a norm�l kurzorok k�z�tt? + 4.2) Hogyan tudom select-elni a lek�rdez�s els� p�r sor�t? + 4.3) Hogy tudom kilist�zni a t�bl�kat vagy m�s dolgokat a PostgreSQL-ben? + 4.4) Hogyan tudok elt�vol�tani egy oszlopot egy t�bl�b�l? + 4.5) Mi a maxim�lis m�rete egy sornak, egy t�bl�nak vagy egy adatb�zisnak? + 4.6) Mekkora adatb�zis lemez ter�let sz�ks�ges egy tipikus sz�veg �llom�ny + t�rol�s�hoz? + 4.7) Hogy tudhatom meg milyen t�bl�k, indexek, adatb�zisok vagy felhaszn�l�k + vannak defini�lva? + 4.8) A lek�rdez�seim lass�ak, vagy nem haszn�lj�k az indexeket. Mi�rt? + 4.9) Hogy tudom ellen�rizni, hogy optimaliz�lta a lek�rdez�s optimaliz�l� a + lek�rdez�sem? + 4.10) Mi az R-tree index? + 4.11) Mi a Genetic Query Optimizer? + 4.12) Hogyan tudok regexp keres�st �s case-insensitive regexp keres�st + haszn�lni? Hogyan tudok indexet haszn�lni case-insensitive keres�shez? + 4.13) Hogyan tudom �szlelni egy lek�rdez�sban, ha egy mez� NULL? + 4.14) Mi a k�l�nbs�g a k�l�nb�z� karaktert�pusok k�z�tt? + 4.15.1) Hogyan tudok l�trehozni automatikusan n�vekv� �rt�k� mez�t? + 4.15.2) Hogyan kaphatom meg egy SERIAL besz�r�s �rt�k�t? + 4.15.3) A currval() �s a nextval() nem teremt holtpont vesz�lyes helyzetet + a felhaszn�l�k k�z�tt? + 4.15.4) Mi�rt nem haszn�l�dnak fel �jra a sequence sz�mok tranzakci� abort + eset�n? + Mi�rt vannak probl�m�k a serial oszlopok sz�moz�s�val? + 4.16) Mi a OID? Mi a TID? + 4.17) Mi a PostgreSQL-ben haszn�lt kifejez�sek jelent�se? + 4.18) Mi�rt kapom ezt a hib�t: "ERROR: Memory exhausted in + AllocSetAlloc()"? + 4.19) Hogyan tudhatom meg PostgreSQL, milyen verzi�t futtatok? + 4.20) Mi�rt kapok "invalid large obj descriptor" hib�t nagy objektumok + kezel�s�n�l? + 4.21) Hogy hozhatok l�tre olyan oszlopot, aminek alap�rtelmezett �r�tke a + jelenlegi id�? + 4.22) Mi�rt olyan lass�ak az al-lek�rdez�seim IN-nel? + 4.23) Hogyan tudok outer join-t v�grehajtani? + 4.24) Hogyan tudok t�bb adatb�zison v�grehajtani lek�rdez�st? + 4.25) Hogy tudok t�bb soros vagy oszlopos eredm�nyt visszaadni egy + funkci�b�l? + 4.26) Mi�rt nem tudom megbizhat�an l�trehozni �s t�r�lni az �tmeneti + t�bl�kat a PL/pgSQL funkci�kban? + 4.27) Milyen replik�ci�s lehet�s�gek vannak? + 4.28) Milyen k�dol�si lehet�s�gek vannak? + + A PostgreSQL kiterjeszt�se + + 5.1) �rtam egy felhaszn�l�i funkci�t. Mi�rt core dumpol az adatb�zis amikor + haszn�lom? + 5.2) Hogyan lehet �j adatt�pusokat �s funkci�kat hozz�adni a PostgreSQL + disztrib�ci�hoz? + 5.3) Hogyan lehet olyan C funkci�t �rni, ami Tuple-t ad vissza? + (t�bb soros t�bb oszlopos eredm�nyek) + 5.4) Megv�ltoztattam egy forr�s �llom�nyt. Mi�rt nem v�ltozik a bin�ris + �jraford�t�s ut�n? + _________________________________________________________________ + + + �ltal�nos k�rd�sek + + + 1.1) Mi a PostgreSQL? Hogy kell kimondani? + �gy ejstd ki: Post-Gres-Q-L. + (Vagy tal�n ink�bb t�ltsd le a kis mp3-at a PostgreSQL homepage-r�l) + + A PostgreSQL a POSTGRES adatb�zis management rendszer egy kieg�sz�t�se, + ami egy k�vetkez� gener�ci�s DBMS kutat�si protot�pus. Megtartja a + POSTGRES adatmodell�t �s gazdag adatt�pus v�laszt�k�t, de a PostQuel + lek�rdez� nyelvet az SQL egy kiterjesztett verzi�j�val helyettes�ti. + A PostgreSQL szabad �s a teljes forr�sk�d hozz�f�rhet�. + + A PostgreSQL fejleszt�s�t egy csapat v�gzi, amelynek minden tagja + megtal�lhat� a PostgreSQL fejleszt�i levelez�si list�n. A jelenlegi + koordin�tor Marc G. Fournier (scrappyp@PostgreSQL.org). Ez a csapat + felel�s minden fejleszt�s�rt. + + A PostgreSQL 1.01 alkot�i Andrew Yu �s Jolly Chen voltak. Sokan + j�rultak hozz� portol�ssal, tesztel�ssel, hibakeres�ssel �s + fejleszt�ssel. Az eredeti Postgres k�d, amib�l a PostgreSQL sz�rmazik + Michael Stonebraker professzor ir�ny�t�sa alatt fejlesztettek az + egyetem programoz�i, tanul�i �s v�gzett tanul�i. + + A szoftver ereeti neve Postgres volt. Amikor SQL funkcional�t�ssal + eg�sz�tett�k ki 1995-ben, a nev�t Postgres95-re v�ltoztatt�k. 1996 + v�g�n kapta mai nev�t. + + 1.2) Mik a PostgreSQL felhaszn�l�si felt�telei? + + Az eredeti angol copyright sz�veg: + -------------------- + PostgreSQL is subject to the following COPYRIGHT: + + PostgreSQL Data Base Management System + + Portions copyright (c) 1996-2002, PostgreSQL Global Development Group + Portions Copyright (c) 1994-6 Regents of the University of California + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose, without fee, and without a written + agreement is hereby granted, provided that the above copyright notice + and this paragraph and the following two paragraphs appear in all + copies. + + IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY + FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND + ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE + PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF + CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, + UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + The above is the BSD license, the classic open-source license. It has + no restrictions on how the source code may be used. We like it and + have no intention of changing it. + -------------------- + + Ami nagyon leegyszer�s�tve azt jelenti, hogy jogod van haszn�lni a + szoftvert mindenf�le ellenszolg�ltat�s (p�nz, stb) n�lk�l, a forr�s + k�dot m�dos�thatod, �s tov�bbadhatod, DE semmilyen, a szoftver haszn�lat�b�l + k�vetkez� k�rosod�s�rt nem v�llal garanci�t a fejleszt�. + + A fenti a BSD licensz, egy klasszikus nyilt-forr�sk�d licensz. Nem + tartalmaz megszor�t�sokat arra, hogy a forr�sk�dot hogyan haszn�lod fel. + Kedvelj�k ezt a licensz form�t �s nem �ll sz�nd�kunkban megv�ltoztatni. + + 1.3) Milyen UNIX oper�ci�s rendszereken fut PostgreSQL? + + �ltal�ban minden UNIX-kompatibilis oper�ci�s rendszer k�pes arra hogy + futtassa a PostgreSQL-t. Azokat a platformokat, amiken tesztelt�k a + kiad�st megtal�lhatod a install�ci�s utas�t�sok k�z�tt. + + 1.4) Milyen nem UNIX oper�ci�s rendszerek el�rhet�ek? + + Kliens + + A libpq C f�ggv�nyk�nyvt�rat, a psql-t �s m�s fel�leteket le lehet �gy + ford�tani, hogy fussanak MS Windows oper�ci�s rendszereken. Ebben az esetben + a kliens MS Windows-on fut �s TCP/IP seg�ts�g�vel kommunik�l a Unixon + fut� szerverrel. A "win32.mak" �llom�ny a kiad�s r�sze, ennek seg�ts�g�vel + lehet Win32 platformokra leford�tani a libpq-t �s a psql-t. A PostgreSQL + ODBC kliensekkel is k�pes kommunik�lni. + + Szerver + + Az adatb�zis szerver Cygwin seg�ts�g�vel fut Windows NT �s Win2k + rendszereken. Tov�bbi inform�ci� tal�lhat� a pgsql/doc/FAQ_MSWIN + �llom�nyban �s a MS Windows FAQ-ban a k�vetkez� helyen: + http://www.PostgreSQL.org/docs/faq-mswin.html. + + Nat�v MS Windows NT/2000/XP portok jelenleg fejleszt�s alatt �llnak. + + 1.5) Hogyan tudok PostgreSQL-t szerezni? + + Az els�dleges anonim ftp oldal: + ftp://ftp.PostgreSQL.org/pub. + A t�k�r oldalak list�ja megtal�lhat� a f� weboldalunkon. + + 1.6) Hogyan kapok term�kt�mogat�st? + + Az els�dleges lista a pgsql-general@postgresql.org. Ez haszn�lhat� + a PostgreSQL-lel kapcsolatos p�rbesz�dekre. Ha fel szeretn�l �ratkozni, + k�ldj egy levelet a k�vetkez� tartalommal (nem t�rggyal) a + pgsql-general-request@postgresql.org c�mre: + subscribe + end + + Van egy hib�kkal kapcsolatos levelez�si lista is: + pgsql-bugs-request@PostgreSQL.org a k�vetkez� tartalommal: + subscribe + end + + A fejleszt?i levelez�si lista: + pgsql-hackers-request@PostgreSQL.org a k�vetkez� tertalommal: + subscribe + end + + Egy�b levelez�si list�k tal�lhat�ak a weboldalunkon: + + http://www.PostgreSQL.org + + Van egy IRC csatorna is #PostgreSQL n�ven ahol felteheted k�r�dseid. + A k�vetkez� unix paranccsal csatlakozhatsz: + irc -c '#PostgreSQL' "$USER" irc.phoenix.net. + + A kereskedelmi term�kt�mogat�st ny�jt� c�gek list�ja el�rhet� itt: + http://www.PostgreSQL.org/users-lounge/commercial-support.html + + 1.7) Melyik a legfrissebb kiad�s? + + A legfrissebb PostgreSQL kiad�s a 7.3. + + A tervek szerint minden negyedik h�napban van �j kiad�s. + + 1.8) Milyen dokument�ci� �ll rendelkez�sre? + + Sz�mos k�zik�nyv, man oldalak �s kis teszt p�ld�k tal�lhat�ak a kiad�sban + a doc/ k�nyvt�r alatt. Az interneten is olvashatod a dokument�ci�t a + k�vetkez� c�men: + http://www.PostgreSQL.org/users-lounge/docs/. + + K�t PostgreSQL k�nyv �rhet� el az interneten a + http://www.PostgreSQL.org/docs/awbook.html �s a + http://www.commandprompt.com/ppbook/ c�meken. + A megv�s�rolhat� k�nyvek list�ja itt tal�lhat�: + http://www.ca.PostgreSQL.org/books/. + A PostgreSQL-lel kapcsolatos technikai jelleg� cikkek gy�jtem�nye: + http://techdocs.PostgreSQL.org/. + + A psql parancs rendelkezik n�h�ny \d utas�t�ssal, amellyekkel list�zhat�ak + az oper�torok, a funkci�k, stb. + + A website is tartalmaz tov�bbi dokument�ci�kat. + + 1.9) Hogyan tal�lok inform�ci�t hib�kr�l vagy hi�nyz� funkcional�t�sr�l? + + A PostgreSQLaz SQL-92 szabv�ny egy kieg�sz�t�se. N�zd meg a TODO list�kat + ha �rdekelnek az ismert hib�k. + + 1.10) Hogy tanuljam meg az SQL nyelvet? + + A PostgreSQL k�nyv a http://www.PostgreSQL.org/docs/awbook.html + c�men tartalmaz SQL alapokat. El�rhet� egy m�sik SQL k�nyv is a + http://www.commandprompt.com/ppbook c�men. Egy sz�p oktat� anyag + tal�lhat� a http://www.intermedia.net/support/sql/sqltut.shtm, + a http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM + �s a http://sqlcourse.com oldalakon. + + Egy m�sik lehet�s�g a "Tan�tsd magad 21 nap alatt SQL-re, m�sodik + kiad�s" a http://members.tripod.com/er4ebus/sql/index.htm. + + Sok felhaszn�l�nak tetszett a gyakorlati SQL k�nyv ("The Practical + SQL Handbook"). + + 1.11) A PostgreSQL 2000. �v kompatibilis? + + Igen, k�nnyed�n kezeli a 2000 ut�ni �s id�sz�m�t�sunk el�tt 2000 el�tti + d�tumokat is. + + 1.12) Hogyan lehet csatlakozni a fejleszt� csapathoz? + + El�ssz�r is t�ltsd le a forr�sk�dot, �s olvasd el a PostgreSQL + fejleszt�i dokumnet�ci�t a web oldalunkon vagy a kiad�sban. Ezut�n + �ratkozz fel a pgsql-hackers �s a pgsql-patches levelez�si list�kra. + V�g�l pedig k�ldj be magas szinvonal� patch-eket a pgsql-patches list�ra. + + Van egy p�r ember, akiknek commit privil�giumuk a PostgreSQL CVS f�n. + �k olyan sok magas szinvonal� patch-et k�ldtek be, hogy az addigi + csapat m�r nem tudta k�vetni, �s nem volt k�ts�g�nk arr�l, hogy a + patch-ek amiket �k k�ldenek j� min�s�g�. + + 1.13) Hogyan k�ldjek hibajelent�st? + + L�togass el a BugTool oldalra: + http://www.PostgreSQL.org/bugs/bugs.php + Itt megtal�lod k�vetend� utas�t�sokat. + + Ellen�rizd az ftp oldalunkon is, hogy nincs-e �jabb verzi� vagy folt. + ftp://ftp.PostgreSQL.org/pub + + 1.14) Milyen a PostgreSQL m�s DBMS-ekkel �sszehasonl�tva? + + Sz�mos n�z�pontb�l lehet vizsg�lni a szoftvert: k�pess�gek, teljes�tm�ny + megb�zhat�s�g, t�mogatotts�g �s �r. + + K�pess�gek + A PostgreSQL rendelkezik a nagy, kereskedelmi DBMS-ek k�pess�geivel: + tranzakci�k, al-lek�rdez�sek, triggerek, n�zetek, k�ls� kulcsok, + integr�t�s �s kifinoult z�rmechanizmusok. Van n�h�ny k�pess�ge, + ami a kereskedelmi adatb�zisokb�l hi�nyzik, mint p�ld�ul a + felhaszn�l� �ltal defini�lt t�pusok, �r�kl�d�s, szab�lyok �s + verzi� kontroll a z�rol�si vit�k reduk�l�s��rt. + + Teljes�tm�ny + A PostgreSQL teljes�tm�nye hasonl�t a kereskedelmi �s m�s ny�lt + adatb�zis szerverek�hez. Lehet bizonyos esetekben lassabb, m�sokban + gyorsabb. A MySQL nev� tanul� RDBMS p�ld�ul gyorsabban hajt v�gre + insert/update m�veleteket, mivel a tranzakci�kat elsum�kolja. + Persze a MySQL nem rendelkezik a k�pess�gek r�szben felsoroltak + nagy r�sz�vel. Mi a megb�zhat�s�gra �s a k�pess�gekre �p�t�nk, b�r + a teljes�tm�ny is n� minden kiad�ssal. Van egy �rdekes oldal a + MySQL �s a PostgreSQL �sszehasonl�t�s�val a + http://openacs.org/philosophy/why-not-mysql.html c�men. + + Megb�zhat�s�g + Tudjuk hogy ha egy DBMS nem megb�zhat�, akkor teljesen haszontalan. + Igyeksz�nk j�l tesztelt, stabil k�dot kiadni, amiben a lehet� + legkevesebb hiba van. Minden kiad�s el�tt eltellik legal�bb 1 + h�nap b�ta teszt, �s a kiad�si t�rt�net is azt mutatja, hogy + stabil k�dot adunk ki, ami k�szen �ll a produkt�v felhaszn�l�sra. + �gy gondoljuk, fel�lm�lunk m�s adatb�zis szoftvereket ezen a t�ren. + + T�mogat�s + A levelez�si list�ink kapcsolatot teremtenek a fejleszt�k + �s felhaszn�l�k csoportj�val , akik seg�tenek a probl�m�k + megold�s�ban. B�r nem tudjuk garant�lni hogy ki tudjuk + jav�tani a hib�t, m�s, kereskedelmi adatb�zis c�gek sem tudj�k. + A fejleszt� csoport k�zvetlen el�r�si lehet�s�ge, a k�z�ss�g, + a dokument�ci� �s a forr�sk�d gyakran t�mogat�st biztos�t, + mint m�s adatb�zisokn�l. Van kereskedelmi, alkalmi t�mogat�s + azoknak, akiknek sz�ks�ge van r� (l�sd: 1.6). + + �r + A PostgreSQL szabad b�rmilyen felhaszn�l�sra, ak�r kereskedelmire + is. A term�khez hozz�adhatod a saj�t forr�sk�djaidat korl�toz�s + n�lk�l, + + 1.15) Hogyan tudom �zletileg segiteni a PostgreSQL-t? + + A PostgreSQL els� oszt�ly� infrastrukt�r�val rendelkezik, amit 1996-ban + ind�tottunk el. Mindent Marc Fourniernek k�sz�nhet�nk, aki l�trehozta + �s karbantartja a rendszert. + + A min�s�gi infrastrukt�ra nagyon fontos egy nyilt forr�s� szoftver + eset�ben. Megv�d az olyan fennakad�sokt�l, amelyek komoly k�s�seket + okoznak a fejleszt�sekben. + + Term�szetesen ez az infrastrukt�ra nem olcs�. Sz�mos havi �s �lland� + kiad�sunk van. Ha a c�gednek van p�nze, amivel t�mogatn� er�fesz�t�seinket, + k�rlek l�togass el a http://store.pgsql.com/shopping/ oldalra. + + B�r a weboldal "PostgreSQL, Inc"-k�nt eml�ti, a hozz�j�rul�sok kiz�r�lag + a PostgreSQL fejleszt�sre �rtend�ek, �s nem egy meghat�rozott c�gnek. Ha + jobban tetszik, k�ldhetsz csekket is a kapcsolati c�mek b�rmelyik�re. + + _________________________________________________________________ + + Felhaszn�l�i kliens k�rd�sek + + 2.1) Van ODBC meghajt� PostgreSQL-hez? + + K�t ODBC meghajt� �rhet� el: PsqlODBC �s a OpenLink ODBC. + + A PsqlODBC a PostgreSQL kiad�s r�sze. Tov�bbi inform�ci� tal�lhat� a + ftp://ftp.PostgreSQL.org/pub/odbc/ oldalon. + + Az OpenLink ODBC-t a http://www.openlinksw.com c�mr�l t�ltheted le. + Ez az � szabv�nyos ODBC kliens szoftver�kkel m�k�dik, �gy minden + �ltaluk t�mogatott platformon (Win, Mac, Unix, VMS) el�rhet� lesz + a PostgreSQL szerver. + + Tal�n olyan vev�knek fogj�k eladni, akik kereskedelmi min�s�g� term�ket + szeretn�nek kapni, de a freeware verzi� mindig el�rhet� lesz. K�rd�seidet + a term�kkel kapcsolatban a postgres95@openlink.co.uk c�men teheted fel. + + Olvasd el az ODBC fejezetet is a programoz�k k�zik�nyv�ben! + + 2.2) Milyen eszk�z�k �llnak rendelkez�sre PostgreSQL Web fejleszt�sekhez? + + Egy sz�p bemutat� olvashat� az adatb�zissal t�mogatott web oldalanr�l + a http://www.webreview.com weboldalon. + + A web integr�ci�hoz a PHP egy kiv�ll� szoftver. Let�lthet� a + http://www.php.net c�mr�l. + + Komplexebb esetekre sokan haszn�lj�k a Perl fel�letet �s a CGI.pm vagy a + mod_perl-t. + + 2.3) Van a PostgreSQL-hez grafikus felhaszn�l�i fel�let? Riport + gener�tor? Be�gyazott lek�rdez� nyelv fel�let? + + Van egy sz�p PgAccess nev� grafikus fel�let�nk, ami riport gener�tork�nt + is haszn�lhat�. A weboldal�t megtal�lod a http://www.pgaccess.org/ c�men. + + A disztrib�ci� tartalmazza az ecpg programot is, ami egy be�gyazott SQL + lek�rdez�si fel�let C nyelvhez. + + 2.4) Milyen programoz�si nyelvekkel lehet el�rni a PostgreSQL szervert? + + A k�vetkez�k: + * C (libpq) + * C++ (libpq++) + * Embedded C (ecpg) + * Java (jdbc) + * Perl (DBD::Pg and perl5) + * ODBC (odbc) + * Python (PyGreSQL) + * TCL (libpgtcl) + * C Easy API (libpgeasy) + * PHP ('pg_' functions, Pear::DB) + + Tov�bbi programoz�si fel�letek �rhet�ek el a + http://www.PostgreSQL.org/interfaces.html �s a + http://gborg.PostgreSQL.org oldalakon. + + _________________________________________________________________ + + Adminisztr�ci�s k�rd�sek + + 3.1) Hogyan tudom a PostgreSQL-t /usr/local/pgsql -t�l elt�r� helyre + install�lni? + + A configure script --prefix param�ter�nek haszn�lat�val. + + 3.2) AMikor elind�tom a postmaster-t, egy "Bad System Call"-t vagy core + dump-ot kapok. + Mi�rt? + + Sz�mos probl�ma lehet, de legel�ssz�r ellen�rizd le, hogy a kerneled + System V kieg�sz�t�sekkel rendelkezik-e. A PostgreSQL haszn�lja a + kernel osztott mem�ria �s szemafor API-j�t. + + 3.3) Amikor megpr�b�lom inditani a postmaster-t, "IpcMemoryCreate" hib�kat + kapok. Mi�rt? + + Vagy nincs megfelel�en konfigur�lva a kerneled osztott mem�ria t�mogat�sa + vagy meg kell nagyobb�tanod a maxim�lis osztott mem�ria m�retet. + A pontos m�ret sz�ks�glet f�gg az architekt�r�dt�l �s att�l hogy h�ny + buffert �s processzt konfigur�lsz a postmasternek. Legal�bb 1 MB + ter�letre sz�ks�ged van. A PostgreSQL Adminisztr�ci� k�zik�nyvben + olvashatsz r�szletesebb inform�ci�kat az osztott mem�ri�r�l �s a + szemaforokr�l. + + 3.4) Amikor megpr�b�lom inditani a postmaster-t, "IpcSemaphoreCreate" + hib�kat kapok. Mi�rt? + + Ha a hiba�zenet ez: " IpcSemaphoreCreate: semget failed (No space + left on device)", akkor a kerneled konfigur�ci�ja nem tesz lehet�v� + elegend� szemafort. A PostgreSQL szerver processzenk�nt 1 szemafort + ig�nyel. Egy �tmeneti megold�s lehet az hogy a postmastert kevesebb + maxim�lis processz sz�mmal inditod el. Haszn�ld a -D param�tert. + Egy sokkal megfelel�bb megold�s az ha n�veled a kerneled SEMMNS + �s SEMMNI param�tereit. + + A hib�s szemaforok is adat�zis lerobban�s�hoz is vezethet nagy terhel�s + eset�n. + Ha a hiba�zenet valami m�s, lehet hogy nincs szemaforok t�mogat�s + forditva a kerneledbe. Olvasd el a PostgreSQL adminisztr�torok + k�zik�nyv�ben az osztott mem�ri�r�l �s a szemaforokr�l sz�l� fejezetet. + + 3.5) Hogyan tudom kontroll�lni a m�s g�pekr�l �rkez� kapcsolat k�r�seket? + + Alap�rtelmez�sben a PostgreSQL a helyi kapcsolatokat Unix socketekkel + val�s�tja meg. M�s g�pek nem lesznek k�pesek csatlakozni, ha nem + enged�lyezed azt -i opci�val a postmasternek, �s nem �ll�tod be host a + alap� azonos�t�st a pg_hba.conf �llom�nyban. Ezzel v�lnak lehet�v� a TCP/IP + kapcsolatok. + + 3.6) Hogyan tudom nagyobb teljes�tm�nyre hangolni az adatb�zisomat? + + Az indexel�s felt�tlen�l gyors�tja a lek�rdez�seket. Az EXPLAIN + parancs lehet�v� teszi hogy l�sd, hogy a PostgreSQL mik�nt interpret�lja + a lek�rdez�st �s melyik indexet haszn�lja. + + Ha sok INSERT m�veletet hajtassz v�gre, csin�ld nagy k�tegekben a COPY + paranccsal. Ez sokkal gyorsabb mint az egyedi INSERT parancsok. M�sodszor: + Azok a m�veletek, amelyek nincsenek tranzakci� blokkon bel�l, azok saj�t + tranzakci�t ind�tanak. Sok m�veletet �rdemes egy tranzakci�n bel�l + v�grehajtani. Ez cs�kkenti a tranzakci� kezel�s t�bbletidej�t. Az indexeket + javasolt a nagy adatv�ltoz�sok el�tt elt�vol�tani, majd �jra l�trehizni. + + Sz�mos teljes�tm�ny jav�t� lehet�s�g van. Kikapcsolhatod az fsync() + m�veletet a postmaster -o -F opci�kval val� ind�t�sakor. �gy nem fog + az amugy lass� fsync() f�ggv�ny megh�v�dni minden tranzakci� v�g�n. + + Haszn�lhatod a postmaster -B opci�j�t is az osztott mem�ria szegmens + m�ret�nek n�vel�s�hez. Ha az �rt�ket t�l magasra �ll�tod, lehet hogy + a postmaster nem indul el, mert t�ll�pted az oper�ci�s rendszer �ltal + megengedett m�retet. Minden buffer 8K m�ret� �s alap�rtelmez�sban 64 + buffer van. + + A -S opci�val n�velheted a szerver �tmeneti rendez�sekre fenntartott + mem�ria ter�let�t. Az �rt�ket kilobyteban add meg. Az alap�rtelmezett + �rt�k 512K. + + Haszn�lhatod a CLUSTER utas�t�st is, hogy a t�bl�kat egy indexnek + megfelel�en csoportos�tsd. Olvasd el a CLUSTER k�zik�nyv oldalt tov�bbi + r�szletek�rt. + + + 3.7) Milyen hibakeres� lehet�s�gek �rhet�ek el? + + A PostgreSQL sz�mos lehet�s�ggel rendelkezik ami �rt�kes lehet a hiba- + keres�sn�l. + + El�ssz�r is, futtathatod a configure scriptet --enable-cassert + opci�val, sok assert() funkci�hiv�s ellen�rzi a program fut�s�t �s + meg�llitja ha valami v�ratlan hiba t�rt�nik. + + Mind a postmaster �s a postgres sz�mos hibakeres� lehet�s�ggel rendelkezik. + Mindig amikor elinditod a postmastert, gy�z�dj meg r�la, hogy a kimenetet + log �llom�nyba k�ld�d. Igy: + cd /usr/local/pgsql + ./bin/postmaster >server.log 2>&1 & + + Ez egy server.log �llom�nyt hoz l�tre a fels� PostgreSQL k�nyvt�rban. + Ez az �llom�ny tartlamaz majd sz�mos hasznos inform�ci�t a szerverrel + kapcsolatos probl�m�kr�l �s hib�kr�l. A postmaster -d opci�j�val lehet + r�szletesebb hibakeres� inform�ci�t kapni. A -d opci�hoz meg kell + hat�rozni egy hiba szintet. Vigy�zz, a magas hibakeres� szint nagy + log �llom�nyt okozhat. + + Ha a postmaster nem fut, akkor futtathatod a postgres szervert + parancssorb�l is, �s az SQL kifejez�st k�zvetlen�l ennek adhatod �t. + Ez csak hibakeres�s eset�ben javasolt. Az �j sor a kifejez�s v�g�t jelenti, + nem a pontosvessz�. Ha hibakeres� opci�kkal forditottad a szervert, + haszn�lhatsz egy debuggert is hogy l�sd hogy mi t�rt�nik. Mivel igy a + szervert nem a postmaster inditotta, nem t�bbfelhaszn�l�s k�rnyezetk�nt + fut, igy a z�rol�si �s a szerverek k�z�tti kommunik�ci�s hiba jelens�gek + nem jelentkeznek. + + Ha m�r fut a postmaster, indits egy psql-t, �s n�zd meg a szerver processz + PID-j�t! Egy debuggert haszn�lhatsz a processzhez csatlakoz�shoz. + Be�llithatsz t�r�spontokat �s elindithatsz lek�rdez�seket. Ha a postgres + indit�sban keresel hib�t, a PGOPTIONS k�rnyezeti v�ltoz�t �llitsd be "-W n" + �rt�kre. Ez n m�sodperc v�rakoz�st id�z el�, igy tudsz csatlakozni a + processzhez, el tdsz hejezni t�r�spontokat, majd folytathatod a ind�t�st. + + A postgres program -s, -A �s -t opci�i is nagyon hasznosak lehetnek + hibakeres�sn�l �s teljes�tm�ny m�r�sn�l. + + Profiling leht�s�ggel is fordithatod a szervert, hogy l�sd melyik + funkci�k foglalj�k el a fut�si id�t. A szerver profile �llom�nyai + a pgsql/data/base/dbname k�nzvt�rba ker�lnek, a kliens profile + �llom�nyok az aktu�lis k�nyvt�rba. Linuxon ehhez sz�ks�ges a + -DLINUX_PROFILE ford�t�si direktiva. + + 3.8) Mi�rt kapok "Sorry, too many clients" (T�l sok kliens) + hib�t csatlakoz�sn�l? + + N�velned kell a postmaster egyidej�leg futtatott szerver processz sz�m + korl�tj�t. + + Az alap�rtelmezett korl�t 32 processz. Ezt n�velhetjed �gy, hogy + �jrainditod a postmastert �s -N opci�val meghat�rotod az �j �rt�ket, + vagy m�dositod a postgresql.conf-ot. + + Ne felejtsd el, hogy ha n�veled a szerver processzek maxim�lis sz�m�t, + akkor bufferek sz�m�t is n�velned kell, legal�bb a processzek sz�m�nak + k�tszeres�re. Nagy processz sz�mokeset�ben val�szin�leg a Unix + konfigur�ci�s param�tereken is n�velni kell. Ellen�rizd a SHMMAX + (az osztott mem�ria szegmensek maxim�lis m�rete), a SEMMNS �s a SEMMNI + (a szemaforok maxim�lis sz�ma), az NPROC (a processzek maxim�lis sz�ma), + a MAXUPRC (felhaszn�l�nk�nti maxim�lis processz sz�m) �s a NFILE �s NINODE + (a megnzitott �llom�nzok maxim�lis sz�ma) param�tereket. A PostgreSQL + az�rt korl�tozza k�l�n a processz sz�mot, hogy a rendszeredet ne terhelhesse + meg t�ls�gosan. + + A PostgreSQL 6.5 verzi�ban a maxim�lis szerver processz sz�m 64 volt �s + a m�dosit�shoz bele kellett irni a include/storage/sinvaladt.h �llom�nyba + �s �jra kellett forditani a servert. + + 3.9) Mi van pgsql_tmp k�nyvt�rban? + + Ez a k�nyvt�r a lek�rdez�s v�grehajt� �ltal l�trehezott �tmeneti + �llom�nyokat tartalmazza. P�ld�ul ha egy rendez�st kell v�grehajtani + egy ORDER BY kifejez�s miatt �s a m?velet t�bb mem�ri�t vesz + ig�nybe, mint amennyit a -S param�ter megenged, akkor az �tmeneti + k�nyvt�rban hoz l�tre egy �llom�nyt a fennmarad� adat t�rol�s�ra. + + Az �tmeneti �llom�nyok t�bbnyire t�rl?dnek, de meg is maradhat ha + p�ld�ul v�ratlan hib�val le�ll a szerver egy rendez�s k�zben. Indit�skor + �s le�llit�skor ezeket az �llom�nyokat t�rli a postmaster. + + 3.10) Mi�rt kell dumpolni �s �jrat�lteni PostgreSQL kiad�s v�lt�s�n�l? + + A PostgreSQL csapat csak apr�bb v�ltoztat�sokat hajt v�gre a kisebb + kiad�sok k�z�tt, igy ha 7.2 verzi�r�l �llsz �t 7.2.1 verzi�ra, akkor nem + sz�ks�ges kidumplonod az adatb�zist. A nagy kiad�sok eset�ben (p�ld�ul + verzi�r�l 7.3-ra �tt�r�sn�l) v�ltozik a belsi� adatstrukt�r�k �s + adat�llom�nyok form�tuma. Ezek a v�ltoz�sok gyakran nagyon �sszetettek, + ez�rt ink�b nem tartunk fenn visszafel� kompatibilit�st. A dump + az adatot �ltal�nos form�tumban irja ki, majd az �j form�tumban lehet + azt visszat�leni. + + Azokban a kiad�sokban, amelyek k�z�tt az adat form�tum nem v�ltozik, + a pg_upgrade program haszn�lhat� dumpol�s �s helzre�llit�s n�lk�l. + + _________________________________________________________________ + + M�k�dtet�si k�rd�sek + + 4.1) Mi a k�l�nbs�g a bin�ris �s a norm�l kurzorok k�z�tt? + + N�zd meg a DECLARE dokument�ci�j�t. + + 4.2) Hogyan tudom select-elni a lek�rdez�s els� p�r sor�t? + + Olvasd el a FETCH dokument�ci�j�t, vagy haszn�ld a SELECT + LIMIT-et. + + Az eg�sz lek�rdez�st v�gre kell hajtani, m�g akkor is, ha csak az els� + p�r sort akarod megkapni. Gondolj arra, hogy a lek�rdez�sben lehet ORDER BY + is. Ha van olyan index, ami megfelel az ORDER BY kifejez�sednek, a + PostgreSQL k�pes lehet az els� n�h�ny rekord visszaad�s�ra, vagy a teljes + lek�rdez�snek le kell futnia, amig a k�rt rekordok le nem gener�l�dnak. + + 4.3) Hogy tudom kilist�zni a t�bl�kat vagy m�s dolgokat a PostgreSQL-ben? + + Elolvashatod a psql forr�s k�dj�ban a pgsql/src/bin/psql/describe.c + �llom�nyban. Ez SQL parancsokat tartalmaz, amelyek azokat a kimeneteket + �llitj�k el�, amiket a per jellel kezd�d� parancsok adnak vissza. + + 4.4) Hogyan tudok elt�vol�tani egy oszlopot egy t�bl�b�l? + + Ez a funkcionalit�s a 7.3 verzi�t�l kezdve �rhet� el az ALTER TABLE + DROP COLUMN -nal. A r�gebbi verti�kban igy lehet v�grehajtani: + BEGIN; + LOCK TABLE old_table; + SELECT ... -- minden oszlopot, kiv�tel amit t�r�lni szeretn�l + INTO TABLE new_table + FROM old_table; + DROP TABLE old_table; + ALTER TABLE new_table RENAME TO old_table; + COMMIT; + + 4.5) Mi a maxim�lis m�rete egy sornak, egy t�bl�nak vagy egy adatb�zisnak? + + A korl�tok: + adatb�zis: korl�tlan (1 TB az �ltalunk ismert lagnagyobb) + t�bla: 16 TB + rekord/sor 1.6TB + mez� 1 GB + a t�bla sorainak sz�ma: korl�tlan + a t�bla oszlopainak sz�ma: 250-1600 az oszlop nevekt�l f�gg�en + A t�bla indexeinek sz�ma: korl�tlan + + Term�szetesen nem igaz�n korl�tlan, de a t�rter�let, mem�ria �s egy�b + k�ls� t�nyez�k korl�tozz�k. A teljesitm�ny romolhat, ha ezek az �rt�kek + szokatlanul nagyok. + + A 16 TB-os legnagyobb t�bla m�ret nem ig�nyel nagy �llom�ny t�mogat�st. + A nagy t�bl�k t�bb 1 GB m�ret� �llom�nyba ker�lnek, igy az �llom�ny + rendszer korl�tai nem l�nyegesek. + + A maxim�lis t�bla m�ret �s az oszlopok maxim�lis oszlop sz�m n�velhet�, + ha az alap�rtelmezett blokkm�retet 32k-ra n�veled. + + 4.6) Mekkora adatb�zis lemez ter�let sz�ks�ges egy tipikus sz�veg �llom�ny + t�rol�s�hoz? + + A PostgreSQL ak�r a sz�veg �llom�ny helyig�nz�nek �tsz�r�s�t is elfoglalhaja. + + K�pzelj el p�ld�ul, egy 100.000 soros sz�veget, aminek minde sora + egy sz�mb�l �s egy sz�vegb�l �ll. Tegy�k el, hogy �tlagosan 20 byte hossz� + sz�vegek. Ez a sz�veg�llom�ny k�r�lbel�l 2.8 MB helyet foglalna el. + A t�bla ami a fenti adatszerkezetet elt�roln�, k�r�lbel�l 6.4 MB-os lenne. + Ezt a k�vetkez�k�ppen sz�molhatjuk ki: + 36 byte: sor fejl�c + 24 byte: egy int mez� + egy sz�veg mez� + 4 byte: mutato + --------------------------------------- + 64 byte soronkent. + + Az adat oldal m�rete a PostgreSQL-ben 8192 byte, igy + 8192 / 64 = 128 rekord adatb�zis oldalank�nt (lefel� kerekitve). + + 100000 rekord / 128 rekord oldalank�nt = 782 adat oldal (felel� kerekitve). + + 782 adatb�zis oldal * 8192 byte olalank�nt = 6,406,144 byte (6.4 MB) + + Az indexek nem foglalnak t�l sokat, de tartalmazz�k az indexelt adatot, + igy ezek is lehetnek nagyok. + + A NULL �rt�kek bitt�rk�pben vannak t�rolva, igy kev�s helyet foglanak. + + + 4.7) Hogy tudhatom meg milyen t�bl�k, indexek, adatb�zisok vagy felhaszn�l�k + vannak defini�lva? + + A psql-ben tal�lsz sz�mos '\' karakterrel kezd�d� utas�t�st az ilyen + inform�ci�k list�z�s�ra. A '\?' segits�g�vel tudot kilist�zni ezeket + a parancsokat. Ezen kiv�l vannak rendszer t�bl�k, amelyek nevei 'pg_' + -vel kezd�dnek. + + Pr�b�ld ki a pgsql/src/tutorial/syscat.source �llom�nyt is. Ez sok + p�ld�t tartalmaz az rendszert�bl�kon v�grehajtott SELECT-ekr�l. + + 4.8) A lek�rdez�seim lass�ak, vagy nem haszn�lj�k az indexeket. Mi�rt? + + Az indexeket nem haszn�lja a szerver minden lek�rdez�sn�l automatikusan. + Csak akkor haszn�l indexet, ha a t�bla m�rete egy megadott als� hat�r + felett van, �s a lek�rdez�s csak a sorok egy kis r�sz�t �rinti. Ez az�rt + van, mert a v�letlen hozz�f�r�s m�g mindig lassabb lehet mint az t�bla + szekvenci�lis olvas�sa. + + Hogy a PostgreSQL meg tudja hat�rozni hogy kell-e indexet haszn�lni, + l�teznie kell egy statisztik�nak a t�bl�r�l. Ez a statisztikai adatok a + VAACUM ANALYZE vagy az egyszer� ANALYZE m�veletek sor�n + j�nnek l�tre. A statisztikai adatok felhaszn�l�s�val az optimaliz�l� + meg tudja hat�rozni, hogy h�ny sor van a t�bl�ban, �s el tudja d�nteni, + hogy haszn�ljon-e indexet. A statisztiaki adatgy�jt�st id�nk�nt v�gre + kell hajtani, ahogy a t�bla adatai v�ltoznak. + + Az indexeket norm�lis esetben nem haszn�lja az ORDER BY vagy + az OUTER JOIN. A szekvenci�lis olvas�s �ltal�ban gyorsabb, mint az + index keres�s egy nagy t�bl�ban. + B�r a LIMIT az ORDER BY-val kombin�lva haszn�lhat indexet, mert + a t�bla csak kis r�sze �rintett. B�r a MIN �s MAX SQL funkci�k sem + haszn�lj�k az indexeket, ezeket az �rt�keket egy ORDER BY + LIMIT + lek�rdez�ssel is le lehet k�rdezni: + SELECT col + FROM tab + ORDER BY col [ DESC ] + LIMIT 1; + + Amikor helyettes�t� jel oper�torokat haszn�lsz, mint a LIKE kulcssz� + vagy a ~, az indexeket csak bizonyos k�r�lm�nyek k�z�tt lehet haszn�lni: + * A keres� string kezdete a keres�si minta elej�n kell hogy legyen. + p�ld�ul: + + A LIKE mint�k nem kezd�dhetnek % jellel. + + ~ (regexp) kifejez�sek nem kezd�dhetnek ^ jellel. + * A keres�si kifejez�s nem kezd�dhet karakter oszt�llyal. + * A case-insensitive keres�s (ILIKE, ~*) nem haszn�lnak indexet + ehelyett funkcion�lis indexet haszn�lnak, amit a 4.12 pontban + tal�lhatsz. + * Az alap�rtelmezett C hellyel kell futtatni az initdb-t. + + 4.9) Hogy tudom ellen�rizni, hogy optimaliz�lta a lek�rdez�s optimaliz�l� + a lek�rdez�sem? + + Olvasd el a dokument�ci� EXPLAIN-r�l sz�l� r�sz�t. + + 4.10) Mi az R-tree index? + + Az R-tree index a t�rbeli adat indexel�s�re alkalmas. Egy hash + index nem k�pes tartom�ny keres�sekre. A B-tree index csak egy + dimenzi�n kezeli a tartom�ny keres�seket. P�ld�ul ha az indexet + egy pont (point adatt�pus) t�pus� mez.re �p�tj�k, gyorsabban + kezeli az olyan jelleg� lek�rdez�seket, mint egy adott k�rben + tal�lhat� pontok. + + Az R-tree tervez�si mint�t eredetileg le�r� sz�veg: + + Guttman, A. "R-trees: A Dynamic Index Structure for Spatial + Searching." Proceedings of the 1984 ACM SIGMOD Int'l Conf on Mgmt of + Data, 45-57. + + Ezt olvashatod Stonebraker "Readings in Database Systems" c. + k�nyv�ben. + + A be�p�tett R-tree kezelni tudj�k a soksz�geket (polygon adatt�pus) + �s a dobozokat (box). Elm�letileg, az R-tree kiterjeszthet� tov�bbi + dimenzi�kra is. Gyakorlatilag ezen dolgoznod kell egy kicsit, �s + m�g nincs dokument�ci�nk arr�l hogy az hogyan m�k�dik. + + 4.11) Mi a Genetic Query Optimizer? + + A GEQO modul a lek�rdez�s optimaliz�ci� sebess�g�t n�veli nagy + mennyis�g� t�bla �sszekapcsol�sa eset�n. Lehet�v� teszi a nagy + lek�rdez�sek v�grehajt�s�t nem teljes keres�ssel. + + 4.12) Hogyan tudok regexp keres�st �s case-insensitive regexp keres�st + haszn�lni? Hogyan tudok indexet haszn�lni case-insensitive keres�shez? + + A ~ oper�tor hajt v�gre regul�ris kifejez�s (regexp) �rtelmez�st, + a ~* ennek case-insensitive v�ltozata. A LIKE case-insensitive + v�ltozata az ILIKE. + + A case-insensitive egyenl�s�g m�veleteket �ltal�ban igy hajtjuk + v�gre: + SELECT * + FROM tab + WHERE lower(col) = 'abc'; + + Ez nem fog indexet haszn�lni, b�r l�trehozhatsz egy funkci� indexet: + CREATE INDEX tabindex ON tab (lower(col)); + + 4.13) Hogyan tudom �szlelni egy lek�rdez�sben, ha egy mez� NULL? + + Haszn�ld "IS NULL"-t �s az "IS NOT NULL"-t. + + 4.14) Mi a k�l�nbs�g a k�l�nb�z� karaktert�pusok k�z�tt? + +Type Internal Name Notes +-------------------------------------------------- +"char" char 1 character +CHAR(n) bpchar blank padded to the specified fixed length +VARCHAR(n) varchar size specifies maximum length, no padding +TEXT text no specific upper limit on length +BYTEA bytea variable-length byte array (null-byte safe) + + L�tni fogod a bels� elnevez�s�ket, ha tanulm�nyozod a rendszert�bl�kat + �s n�h�ny hiba�zenetet. + + Az ut�bbi n�gy a "varlena" t�pusok, ami a t�rol�suk m�dj�ra utal: + az els� 4 byte a lemezen a hossz�s�g, a t�bbi az adat. A val�di m�ret + teh�t nagyobb mint a deklar�lt hossz�s�g.Ezek azadatok t�m�ritve + t�rol�dnak el, igy kevesebb helyet foglalnek el az el�re sz�mitottn�l. + + A CHAR(n) a legjobb megold�s, ha stabil hossz�s�g� stringet t�rolsz. + A VARCHAR(n) j� arra az esetekre, ha a hossz�s�g v�ltozik, de van + fels� korl�tja. A TEXT t�pus korl�tlan hossz�s�g� (1 GB-ig) sz�vegek + t�rol�s�ra alklamas. A BYTEA bin�ris adatok t�rol�s�ra van. A + teljesitm�ny mutat�i hasonl�ak ezenek a t�pusoknak. + + 4.15.1) Hogyan tudok l�trehozni automatikusan n�vekv� �rt�k� mez�t? + + A PostgreSQL rendelkezik egy SERIAL adatt�pussal. Ez egy szekvenci�t + �s egy indexet hoz l�tre az oszlopon. P�ld�ul ez: + CREATE TABLE person ( + id SERIAL, + name TEXT + ); + + ugyanezt jelenti: + CREATE SEQUENCE person_id_seq; + CREATE TABLE person ( + id INT4 NOT NULL DEFAULT nextval('person_id_seq'), + name TEXT + ); + CREATE UNIQUE INDEX person_id_key ON person ( id ); + + A szekvenci�kkal kapcsolatban olvasd el a create_sequence man + oldalt. A sor OID-j�t is haszn�lhatod egyedi azonosit�k�nt, b�r + ebben az esetben figyelj a pg_gump haszn�lat�n�l a -o opci�ra + (COPY WITH OIDS, m�sol�s OID-dal), hogy meg?rizd az �rt�keket. + + 4.15.2) Hogyan kaphatom meg egy SERIAL besz�r�s �rt�k�t? + + Egy megold�s erre az, ha a nextval() funkci�val megszerzed az + �rt�ket m�g miel�tt besz�rn�d az adatot a t�bl�ba. Erre itt l�thatsz + egy p�ld�t: + new_id = execute("SELECT nextval('person_id_seq')"); + execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal')"); + + Esetleg lek�rdezheted a szekvencia �llapot�t a sor besz�r�sa ut�n. + execute("INSERT INTO person (name) VALUES ('Blaise Pascal')"); + new_id = execute("SELECT currval('person_id_seq')"); + + V�g�l pedig, haszn�lhatod a visszaadott OID �rt�ket is, b�r ez a lehet� + legkev�sb� portolhat�. Perl DBI-ben, Edmund Mergl DBD::Pg modulj�ban + az OID �rt�k haszn�lhat� a $sth->execute() ut�n ($sth->{pg_oid_status}). + + 4.15.3) A currval() �s a nextval() nem teremt holtpont vesz�lyes helyzetet + a felhaszn�l�k k�z�tt? + + Nem. A currval() funkci� a szerver processzed �ltal adott �rt�ket adja + vissza, nem pedig a t�bbi szerver processz �ltal adottat. + + 4.15.4) Mi�rt nem haszn�l�dnak fel �jra a sequence sz�mok tranzakci� + abort eset�n? + Mi�rt vannak probl�m�k a serial oszlopok sz�moz�s�val? + + A p�rhuzamoss�g fejleszt�se �rdek�ben a sorozat sz�mokat k�r�sre + adja ki a szerver fut� tranzakci�knak, �s azokat nem z�rja, amig + a tranzakci� v�get nem �r. Ez jukakat okoz a sz�moz�sokban a + visszaforditott tranzakci�k miatt. + + 4.16) Mi a OID? Mi a TID? + + Az OID a PostgreSQL egyedi sor azonosit�ja. Minden sor, ami l�trej�n + a szerveren, kap egy OID-t. Minden OID, amit az initdb alatt j�n l�tre + 16384 alatt van (l�sd include/access/transam.h). Minden, felhaszn�l� + �ltal l�trehozott OID legal�bb ennyi. Alap�rtelmez�sben, az OID + nem csak a t�bl�ban vagy az adatb�zisban egyedi, hanem a teljes + PostgreSQL adatb�zis rendszerben. + + A PostgreSQL az OID-okat a bels� t�bl�iban haszn�lja a sorok t�bl�k + k�z�tt �sszekapcsol�s�hoz. Ezek az OID-k haszn�lhat�ak a rekordok + azonosit�s�ra is amikor t�bl�kat csatol �ssze a szerver (JOIN). + Az OID-ot haszn�lhatod mez� t�pusk�nt is, �s indexelheted is. + + Az OID �rt�k egy k�zponti ter�letr�l sz�rmazik, amit minden szerver + processz haszn�l. Ha az OID-ot valami m�sra szeretn�d cser�lni: + CREATE TABLE new_table(old_oid oid, mycol int); + SELECT old_oid, mycol INTO new FROM old; + COPY new TO '/tmp/pgtable'; + DELETE FROM new; + COPY new WITH OIDS FROM '/tmp/pgtable'; + + Az OID 4 byte-os integer �rt�kk�nt t�rol�dik, igy 4 milli�rdn�l t�lcsordul. + M�g soha senki nem jelezte hogy ez t�rt�nt volna, �s ezt a korl�tot + igyeksz�nk elt�volitani, m�g miel�tt b�rki �szrevenn�. + + A TID a fizikai sorok blokk �s offszet c�mmel val� azonosit�s�ra szolg�l. + A TID v�ltozik minden rekord m�dosit�s �s t�rl�s alkalm�val. Ezeket az + indexek haszn�lj�k hogy a fizikai sort gyorsan megtal�lj�k. + + 4.17) Mi a PostgreSQL-ben haszn�lt kifejez�sek jelent�se? + + N�hol a forr�s k�dban �s a dokumnet�ci�ban tal�lhat�ak kifejez�sek, + amelyek �ltal�nosabb jelent�ssel b�rnak. Itt van n�h�ny: + * t�bla (table), rel�ci� (relation), oszt�ly (class) + * sor (row), rekord (record), tuple (nincs magyar jelent�s) + * oszlop (column), mez� (field), attributum (attribute) + * retrieve, select + * helyettesit (replace), m�dosit (update) + * hozz�f�z (append), besz�r (insert) + * OID, sorozat �rt�k (serial value) + * portal, cursor + * range variable, t�bla n�v, t�bla alias + + Az �ltal�nos adatb�zis kifejez�sek �sszefoglal�j�t itt olvashat�: + http://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary + /glossary.html + + 4.18) Mi�rt kapom ezt a hib�t: "ERROR: Memory exhausted in + AllocSetAlloc()"? + + Lehet hogy elfogyott a virtu�lis mem�ri�d, vagy a kerneled er�forr�s + korl�tai alacsonyak. Pr�b�ld ki ezt miel�tt elinditan�d a postmastert: + ulimit -d 262144 + limit datasize 256m + + A shellt�l f�gg�en ezek k�z�l csak az egyik fut majd le, de a + processzek adatszegmens�t sokkal magasabbra �llitja, ami tal�n + el�g lesz a lek�rdez�s v�grehajt�s�hoz. Ez az utas�t�s a jelenlegi + processzre (a shelled) �rv�nyes, �s minden �ltala l�trehozott + processzre. Ha probl�m�d van az SQL klienssel, mert a szerver + t�l nagy adatot k�ld vissza, pr�b�ld meg e klienssel is ugyanezt. + + 4.19) Hogyan tudhatom meg PostgreSQL, milyen verzi�t futtatok? + + A psql programban select version(); + + 4.20) Mi�rt kapok "invalid large obj descriptor" hib�t nagy objektumok + kezel�s�n�l? + + A nagy objektumok kezel�s�t egy tranzakci�s blokkban helyezd el. + (BEGIN �s COMMIT k�z�tt) + + Jelenleg a PostgreSQL ezt a szab�lyt azzal teszi k�telez�v�, hogy a + tranzakci� v�g�n a nagy objektumokat lez�rja, igy a tranzakci� ut�n + az els� m�velet amit az objektumon v�grahajtan�l hib�s lesz. + + Ha olyan programoz�si fel�letet haszn�lsz mint az ODBC vagy a JDBC + akkor val�szin�leg ki kell kapcsolnod az auto-commit-ot. + + + 4.21) Hogy hozhatok l�tre olyan oszlopot, aminek alap�rtelmezett + �r�tke a jelenlegi id�? + + Haszn�ld a CURRENT_TIMESTAMP -ot: + CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP ); + + 4.22) Mi�rt olyan lass�ak az al-lek�rdez�seim IN-nel? + + Jelenleg az al-lek�rdez�seket a k�ls� lek�rdez�shez csatoljuk. Ha + az allek�rdez�s csak kev�s sort eredm�nyez �s a k�ls� lek�rdez�s + sokat, akkor az IN is gyors. Az EXISTS kulcssz� haszn�lat�val + gyorsithatod a lek�rdez�seket. + SELECT * + FROM tab + WHERE col IN (SELECT subcol FROM subtab); + + EXISTS haszn�lat�val: + SELECT * + FROM tab + WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = col); + + Ahhoz hogy ez gyorsan fusson le, a subcol indexelt oszlopnak kell + hogy legyen. Rem�lj�k ezt a korl�tot siker�l hamarosan legy�zn�nk. + + 4.23) Hogyan tudok outer join-t v�grehajtani? + + A PostgreSQL a szabv�nyos SQL szintaktik�t k�veti. Itt van k�t p�lda: + SELECT * + FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col); + + vagy + SELECT * + FROM t1 LEFT OUTER JOIN t2 USING (col); + + Ezek az identikus lek�rdez�sek �sszekapcsolj�k a t1.col �s a t2.col + mez�ket, �s a t1 b�rmelyik kapcsolatlan sor�t is visszadj�k. A RIGHT + JOIN a t2 kapcsolatlan sorait adta volna vissza, a FULL JOIN pedig + a kapcsolt, �s mindk�t t�bla kapcsolatlan sorait adja. Az OUTER + kulcssz� opcion�lis, a LEFT, RIGHT �s FULL JOIN szintaktikailag + helyes. Az �tlagos �sszekapcsol�sokat INNER JOIN-nak nevezz�k. + + Az el�z� kiad�sokban a OUTER JOIN lek�rdez�seket UNION �s NOT IN + kulcsszavakkal lehetett szimul�lni. P�ld�ul a tab1 �s a tab2 + �sszekapcsol�sa: + SELECT tab1.col1, tab2.col2 + FROM tab1, tab2 + WHERE tab1.col1 = tab2.col1 + UNION ALL + SELECT tab1.col1, NULL + FROM tab1 + WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2) + ORDER BY col1 + + 4.24) Hogyan tudok t�bb adatb�zison v�grehajtani lek�rdez�st? + + Arra nincs lehet�s�g, hogy m�s adatb�zisb�l k�rdezz le adatot. + Mivel a PostgreSQL adatb�zis specifikus rendszer t�bl�kat t�lt + be, bizonytalan hogy egy adatb�zisok k�z�tti lek�rdez�snek hogyan + kellene viselkednie. + + A contrib/dblink k�nyvt�rban tal�lsz egy megold�st erre, ami + funkci� hiv�sok segits�g�vel m�k�dik. Persze, a kliens hozhat l�tre + szimult�n kapcsolatot t�bb adatb�zissal, �s �sszef�s�lheti az + eredm�nyeket. + + 4.25) Hogy tudok t�bb soros vagy oszlopos eredm�nyt visszaadni egy + funkci�b�l? + + A PL/pgSQL t�rolt elj�r�s nyelvvel refcursor haszn�lat�val. + R�szletesen itt: + http://www.PostgreSQL.org/idocs/index.php?plpgsql-cursors.html + + 4.26) Mi�rt nem tudom megbizhat�an l�trehozni �s t�r�lni az �tmeneti + t�bl�kat a PL/pgSQL funkci�kban? + + A PL/pgSQL cacheli a funkci�k tartalm�t, aminek az a szerencs�tlen + mell�khat�sa, hogy ha egy PL/pgSQL funkci� haszn�l egy �tmeneti + t�bl�t, ami k�s?bb t�rl�dik majd ujra l�trej�n, akkor az �jra lefut� + funkci� nem fogja megtal�lni a t�bl�t, mert a cache v�ltozat a r�gi + t�bl�ra tartalmaz mutat�t. A megold�s erre az EXECUTE utas�t�s + haszn�lata az �tmeneti t�bl�k kezel�s�re PL/pgSQL-ben. Ez a + lek�rdez�s �jraford�t�s�t fogja el�id�zni minden alkalommal. + + 4.27) Milyen replik�ci�s lehet�s�gek vannak? + + Sz�mos master/slave replik�ci�s lehet�s�g l�tezik. Ez csak a master + adatb�zis sz�m�ra teszi lehet�v�, hogy az adatokat v�ltoztassa. Egy + List�t olvashatsz ezekr�l itt: + http://gborg.PostgreSQL.org/genpage?replication_research + + Egy t�bbfelhaszn�l�s replik�ci�s rendszer k�sz�l itt: + http://gborg.PostgreSQL.org/project/pgreplication/projdisplay.php. + + 4.28) Milyen k�dol�si lehet�s�gek vannak? + + - A contrib/pgcrypto tartlamaz sz�mos SQL lek�rdez�sben haszn�lhat� k�dol�st. + - A kliens-szerver kommunik�ci� rejtjelez�s�re a hostssl haszn�lhat�. + Ezt a pg_hba.conf-ben enged�lyeztheted. + - Az adatb�zis felhszn�l�k jelszavait t�rol�skor k�dolja a rendszer. + R�gebbi verzi�kban a PASSWORD_ENCRYPTION opci�val lehetett + bekapcsolni. + - A szerveren haszn�lhatsz k�dolt f�jrendszert. + _________________________________________________________________ + + A PostgreSQL kiterjeszt�se + + 5.1) �rtam egy felhaszn�l�i funkci�t. Mi�rt core dumpol az adatb�zis amikor + haszn�lom? + + Sz�mos probl�ma lehet. El�bb prob�ld ki a funkci�dat egy k�l�n�ll� + alkalmaz�sban. + + 5.2) Hogyan lehet �j adatt�pusokat �s funkci�kat hozz�adni a PostgreSQL + disztrib�ci�hoz? + + K�ldd el a kieg�sz�t�seid a pgsql-hackers levelez�si list�ra �s a + forr�skodjaid v�g�l a contrib-ban k�tnek ki. + + 5.3) Hogyan lehet olyan C funkci�t �rni, ami Tuple-t ad vissza? + + A 7.3 verzi�t�l kezdve a PostgreSQL t�mogatja a t�bl�zatokat + viszzaad� funkci�kat C, PL/pgSQL �s SQL nyelveken. B�vebb + dokument�ci�t a Programoz� k�zik�nyvben tal�lsz. Egy C p�lda + funkci� tal�lhat� a contrib/tablefunc k�nyvt�rban. + + 5.4) Megv�ltoztattam egy forr�s �llom�nyt. Mi�rt nem v�ltozik a bin�ris + �jraford�t�s ut�n? + + A Makefile-ok nem ismerik a include �llom�nyok megfelel� f�gg�s�geit. + V�gre kell hajtanod egy make clean-t, majd �jra egy make-t. Ha GCC-t + haszn�lsz felhaszn�lhatod a configure script --enable-depend opci�j�t, + �gy a compiler maga fogja ellen�rizni a f�gg�s�geket. + + diff --git a/doc/FAQ_turkish b/doc/FAQ_turkish new file mode 100644 index 00000000000..ce15326b6fe --- /dev/null +++ b/doc/FAQ_turkish @@ -0,0 +1,709 @@ + + PostgreSQL i�in S�k�a Sorulan Sorular (SSS) Son g�ncelleme : 19 May�s + 2003 Pazartesi - 03:05:21 Current maintainer: Bruce Momjian + (pgman@candle.pha.pa.us ) �eviren : Devrim G�ND�Z (devrim@gunduz.org ) + Nicolai Tufar (ntufar@yahoo.com ) Bu belgenin en g�ncel hali, + http://www.PostgreSQL.org/docs/faqs/FAQ_turkish.html ve + http://www.gunduz.org/seminer/pg/FAQ_turkish adreslerinde g�r�lebilir. + Platforma �zel sorular�n�z,http://www.PostgreSQL.org/docs/index.html + adresinde yan�tlan�r.. + ---------------------------------------------------------------------- + -- Genel Sorular 1.1 <#1.1>) PostgreSQL nedir? Nas�l okunur? 1.2 + <#1.2>) PostgreSQL' in haklar� nedir? 1.3 <#1.3>) PostgreSQL, hangi + Unix platformlar�nda �al�s�r? 1.4 <#1.4>) Hangi Unix olmayan + uyarlamalar� bulunmaktad�r? 1.5 <#1.5>) PostgreSQL'i nereden + indirebilirim? 1.6 <#1.6>) Deste�i nereden alabilirim? 1.7 <#1.7>) En + son s�r�m� nedir? 1.8 <#1.8>) Hangi belgelere ulasabilirim? 1.9 + <#1.9>) Bilinen hatalar ya da eksik �zelliklere nereden ulasabilirim? + 1.10 <#1.10>) Nas�l SQL ��renebilirim? 1.11 <#1.11>) PostgreSQL 2000 + y�l�na uyumlu mudur? 1.12 <#1.12>) Geli�tirme tak�m�na nas�l + kat�labilirim?? 1.13 <#1.13>) Bir hata raporunu nas�l g�nderebilirim? + 1.14 <#1.14>) PostgreSQL, diger VTYS(DBMS lerle nas�l + kar��la�t�r�labilir? 1.15 <#1.15>) PostgreSQL'e maddi a��dan nas�l + destek olabilirim? Kullan�c�/istemci Sorular� 2.1 <#2.1>) Are there + ODBC drivers for PostgreSQL? 2.2 <#2.2>) What tools are available for + using PostgreSQL with Web pages? 2.3 <#2.3>) Does PostgreSQL have a + graphical user interface? 2.4 <#2.4>) What languages are available to + communicate with PostgreSQL? Administrative Questions 3.1 <#3.1>) How + do I install PostgreSQL somewhere other than //usr/local/pgsql/? 3.2 + <#3.2>) When I start /postmaster/, I get a /Bad System Call/ or core + dumped message. Why? 3.3 <#3.3>) When I try to start /postmaster/, I + get /IpcMemoryCreate/ errors. Why? 3.4 <#3.4>) When I try to start + /postmaster/, I get /IpcSemaphoreCreate/ errors. Why? 3.5 <#3.5>) How + do I control connections from other hosts? 3.6 <#3.6>) How do I tune + the database engine for better performance? 3.7 <#3.7>) What debugging + features are available? 3.8 <#3.8>) Why do I get /"Sorry, too many + clients"/ when trying to connect? 3.9 <#3.9>) What is in the + /pgsql_tmp/ directory? 3.10 <#3.10>) Why do I need to do a dump and + restore to upgrade PostgreSQL releases? Operational Questions 4.1 + <#4.1>) What is the difference between binary cursors and normal + cursors? 4.2 <#4.2>) How do I SELECT only the first few rows of a + query? 4.3 <#4.3>) How do I get a list of tables or other things I can + see in /psql/? 4.4 <#4.4>) How do you remove a column from a table? + 4.5 <#4.5>) What is the maximum size for a row, a table, and a + database? 4.6 <#4.6>) How much database disk space is required to + store data from a typical text file? 4.7 <#4.7>) How do I find out + what tables, indexes, databases, and users are defined? 4.8 <#4.8>) My + queries are slow or don't make use of the indexes. Why? 4.9 <#4.9>) + How do I see how the query optimizer is evaluating my query? 4.10 + <#4.10>) What is an R-tree index? 4.11 <#4.11>) What is the Genetic + Query Optimizer? 4.12 <#4.12>) How do I perform regular expression + searches and case-insensitive regular expression searches? How do I + use an index for case-insensitive searches? 4.13 <#4.13>) In a query, + how do I detect if a field is NULL? 4.14 <#4.14>) What is the + difference between the various character types? 4.15.1 <#4.15.1>) How + do I create a serial/auto-incrementing field? 4.15.2 <#4.15.2>) How do + I get the value of a SERIAL insert? 4.15.3 <#4.15.3>) Don't + /currval()/ and /nextval()/ lead to a race condition with other users? + 4.15.4 <#4.15.4>) Why aren't my sequence numbers reused on transaction + abort? Why are there gaps in the numbering of my sequence/SERIAL + column? 4.16 <#4.16>) What is an OID? What is a TID? 4.17 <#4.17>) + What is the meaning of some of the terms used in PostgreSQL? 4.18 + <#4.18>) Why do I get the error /"ERROR: Memory exhausted in + AllocSetAlloc()"/? 4.19 <#4.19>) How do I tell what PostgreSQL version + I am running? 4.20 <#4.20>) Why does my large-object operations get + /"invalid large obj descriptor"/? 4.21 <#4.21>) How do I create a + column that will default to the current time? 4.22 <#4.22>) Why are my + subqueries using |IN| so slow? 4.23 <#4.23>) How do I perform an outer + join? 4.24 <#4.24>) How do I perform queries using multiple databases? + 4.25 <#4.25>) How do I return multiple rows or columns from a + function? 4.26 <#4.26>) Why can't I reliably create/drop temporary + tables in PL/PgSQL functions? 4.27 <#4.27>) What replication options + are available? 4.28 <#4.28>) What encryption options are available? + Extending PostgreSQL 5.1 <#5.1>) I wrote a user-defined function. When + I run it in /psql/, why does it dump core? 5.2 <#5.2>) How can I + contribute some nifty new types and functions to PostgreSQL? 5.3 + <#5.3>) How do I write a C function to return a tuple? 5.4 <#5.4>) I + have changed a source file. Why does the recompile not see the change? + ---------------------------------------------------------------------- + -- General Questions 1.1) What is PostgreSQL? How is it pronounced? + PostgreSQL is pronounced /Post-Gres-Q-L/. PostgreSQL is an enhancement + of the POSTGRES database management system, a next-generation DBMS + research prototype. While PostgreSQL retains the powerful data model + and rich data types of POSTGRES, it replaces the PostQuel query + language with an extended subset of SQL. PostgreSQL is free and the + complete source is available. PostgreSQL development is performed by a + team of developers who all subscribe to the PostgreSQL development + mailing list. The current coordinator is Marc G. Fournier + (scrappy@PostgreSQL.org ). (See section 1.6 <#1.6> on how to join). + This team is now responsible for all development of PostgreSQL. The + authors of PostgreSQL 1.01 were Andrew Yu and Jolly Chen. Many others + have contributed to the porting, testing, debugging, and enhancement + of the code. The original Postgres code, from which PostgreSQL is + derived, was the effort of many graduate students, undergraduate + students, and staff programmers working under the direction of + Professor Michael Stonebraker at the University of California, + Berkeley. The original name of the software at Berkeley was Postgres. + When SQL functionality was added in 1995, its name was changed to + Postgres95. The name was changed at the end of 1996 to PostgreSQL. + 1.2) What is the copyright on PostgreSQL? PostgreSQL is subject to the + following COPYRIGHT: PostgreSQL Data Base Management System Portions + copyright (c) 1996-2002, PostgreSQL Global Development Group Portions + Copyright (c) 1994-6 Regents of the University of California + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose, without fee, and without a written + agreement is hereby granted, provided that the above copyright notice + and this paragraph and the following two paragraphs appear in all + copies. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO + ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS + SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA + HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF + CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" + BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE + MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. The + above is the BSD license, the classic open-source license. It has no + restrictions on how the source code may be used. We like it and have + no intention of changing it. 1.3) What Unix platforms does PostgreSQL + run on? In general, a modern Unix-compatible platform should be able + to run PostgreSQL. The platforms that had received explicit testing at + the time of release are listed in the installation instructions. 1.4) + What non-Unix ports are available? *Client* It is possible to compile + the /libpq/ C library, psql, and other interfaces and client + applications to run on MS Windows platforms. In this case, the client + is running on MS Windows, and communicates via TCP/IP to a server + running on one of our supported Unix platforms. A file /win32.mak/ is + included in the distribution for making a Win32 /libpq/ library and + /psql/. PostgreSQL also communicates with ODBC clients. *Server* The + database server can run on Windows NT and Win2k using Cygwin, the + Cygnus Unix/NT porting library. See /pgsql/doc/FAQ_MSWIN/ in the + distribution or the MS Windows FAQ at + http://www.PostgreSQL.org/docs/faqs/text/FAQ_MSWIN + www.PostgreSQL.org/docs/faqs/text/FAQ_MSWIN>. A native port to MS Win + NT/2000/XP is currently being worked on. For more details on the + current status of PostgreSQL on Windows see + http://techdocs.postgresql.org/guides/Windows + techdocs.postgresql.org/guides/Windows>. There is also a Novell + Netware 6 port at http://forge.novell.com. 1.5) Where can I get + PostgreSQL? The primary anonymous ftp site for PostgreSQL is + ftp://ftp.PostgreSQL.org/pub. For mirror sites, see our main web site. + 1.6) Where can I get support? The main mailing list is: + pgsql-general@PostgreSQL.org . It is available for discussion of + matters pertaining to PostgreSQL. To subscribe, send mail with the + following lines in the body (not the subject line): subscribe end to + pgsql-general-request@PostgreSQL.org . There is also a digest list + available. To subscribe to this list, send email to: + pgsql-general-digest-request@PostgreSQL.org with a body of: subscribe + end Digests are sent out to members of this list whenever the main + list has received around 30k of messages. The bugs mailing list is + available. To subscribe to this list, send email to + pgsql-bugs-request@PostgreSQL.org with a body of: subscribe end There + is also a developers discussion mailing list available. To subscribe + to this list, send email to pgsql-hackers-request@PostgreSQL.org with + a body of: subscribe end Additional mailing lists and information + about PostgreSQL can be found via the PostgreSQL WWW home page at: + http://www.PostgreSQL.org There is also an IRC channel on EFNet and + OpenProjects, channel /#PostgreSQL/. I use the Unix command |irc -c + '#PostgreSQL' "$USER" irc.phoenix.net.| A list of commercial support + companies is available at + http://www.ca.PostgreSQL.org/users-lounge/commercial-support.html. + 1.7) What is the latest release? The latest release of PostgreSQL is + version 7.3.3. We plan to have major releases every four months. 1.8) + What documentation is available? Several manuals, manual pages, and + some small test examples are included in the distribution. See the + //doc/ directory. You can also browse the manuals online at + http://www.PostgreSQL.org/docs. There are two PostgreSQL books + available online at http://www.PostgreSQL.org/docs/awbook.html and + http://www.commandprompt.com/ppbook/. There is a list of PostgreSQL + books available for purchase at http://www.ca.PostgreSQL.org/books/. + There is also a collection of PostgreSQL technical articles at + http://techdocs.PostgreSQL.org/. /psql/ has some nice \d commands to + show information about types, operators, functions, aggregates, etc. + Our web site contains even more documentation. 1.9) How do I find out + about known bugs or missing features? PostgreSQL supports an extended + subset of SQL-92. See our TODO developer.PostgreSQL.org/todo.php> list + for known bugs, missing features, and future plans. 1.10) How can I + learn SQL? The PostgreSQL book at + http://www.PostgreSQL.org/docs/awbook.html teaches SQL. There is + another PostgreSQL book at http://www.commandprompt.com/ppbook. + www.commandprompt.com/ppbook/> There is a nice tutorial at + http://www.intermedia.net/support/sql/sqltut.shtm, + www.intermedia.net/support/sql/sqltut.shtm> at + http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM, + ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM> and at + http://sqlcourse.com. sqlcourse.com/> Another one is "Teach Yourself + SQL in 21 Days, Second Edition" at + http://members.tripod.com/er4ebus/sql/index.htm Many of our users like + /The Practical SQL Handbook/, Bowman, Judith S., et al., + Addison-Wesley. Others like /The Complete Reference SQL/, Groff et + al., McGraw-Hill. 1.11) Is PostgreSQL Y2K compliant? Yes, we easily + handle dates past the year 2000 AD, and before 2000 BC. 1.12) How do I + join the development team? First, download the latest source and read + the PostgreSQL Developers documentation on our web site, or in the + distribution. Second, subscribe to the /pgsql-hackers/ and + /pgsql-patches/ mailing lists. Third, submit high quality patches to + pgsql-patches. There are about a dozen people who have commit + privileges to the PostgreSQL CVS archive. They each have submitted so + many high-quality patches that it was impossible for the existing + committers to keep up, and we had confidence that patches they + committed were of high quality. 1.13) How do I submit a bug report? + Please visit the PostgreSQL BugTool page at + http://www.PostgreSQL.org/bugs/bugs.php, which gives guidelines and + directions on how to submit a bug report. Also check out our ftp site + ftp://ftp.PostgreSQL.org/pub to see if there is a more recent + PostgreSQL version or patches. 1.14) How does PostgreSQL compare to + other DBMSs? There are several ways of measuring software: features, + performance, reliability, support, and price. *Features* PostgreSQL + has most features present in large commercial DBMSs, like + transactions, subselects, triggers, views, foreign key referential + integrity, and sophisticated locking. We have some features they do + not have, like user-defined types, inheritance, rules, and + multi-version concurrency control to reduce lock contention. + *Performance* PostgreSQL has performance similar to other commercial + and open source databases. it is faster for some things, slower for + others. In comparison to MySQL or leaner database systems, we are + slower on inserts/updates because of transaction overhead. Of course, + MySQL does not have any of the features mentioned in the /Features/ + section above. We are built for reliability and features, though we + continue to improve performance in every release. There is an + interesting Web page comparing PostgreSQL to MySQL at + http://openacs.org/philosophy/why-not-mysql.html + openacs.org/philosophy/why-not-mysql.html> *Reliability* We realize + that a DBMS must be reliable, or it is worthless. We strive to release + well-tested, stable code that has a minimum of bugs. Each release has + at least one month of beta testing, and our release history shows that + we can provide stable, solid releases that are ready for production + use. We believe we compare favorably to other database software in + this area. *Support* Our mailing lists provide contact with a large + group of developers and users to help resolve any problems + encountered. While we cannot guarantee a fix, commercial DBMSs do not + always supply a fix either. Direct access to developers, the user + community, manuals, and the source code often make PostgreSQL support + superior to other DBMSs. There is commercial per-incident support + available for those who need it. (See FAQ section 1.6 <#1.6>.) *Price* + We are free for all use, both commercial and non-commercial. You can + add our code to your product with no limitations, except those + outlined in our BSD-style license stated above. 1.15) How can I + financially assist PostgreSQL? PostgreSQL has had a first-class + infrastructure since we started in 1996. This is all thanks to Marc + Fournier, who has created and managed this infrastructure over the + years. Quality infrastructure is very important to an open-source + project. It prevents disruptions that can greatly delay forward + movement of the project. Of course, this infrastructure is not cheap. + There are a variety of monthly and one-time expenses that are required + to keep it going. If you or your company has money it can donate to + help fund this effort, please go to http://store.pgsql.com/shopping/ + and make a donation. Although the web page mentions PostgreSQL, Inc, + the "contributions" item is solely to support the PostgreSQL project + and does not fund any specific company. If you prefer, you can also + send a check to the contact address. + ---------------------------------------------------------------------- + -- User Client Questions 2.1) Are there ODBC drivers for PostgreSQL? + There are two ODBC drivers available, PsqlODBC and OpenLink ODBC. You + can download PsqlODBC from + http://gborg.postgresql.org/project/psqlodbc/projdisplay.php + gborg.postgresql.org/project/psqlodbc/projdisplay.php>. OpenLink ODBC + can be gotten from http://www.openlinksw.com www.openlinksw.com/>. It + works with their standard ODBC client software so you'll have + PostgreSQL ODBC available on every client platform they support (Win, + Mac, Unix, VMS). They will probably be selling this product to people + who need commercial-quality support, but a freeware version will + always be available. Please send questions to + postgres95@openlink.co.uk . 2.2) What tools are available for using + PostgreSQL with Web pages? A nice introduction to Database-backed Web + pages can be seen at: http://www.webreview.com For Web integration, + PHP is an excellent interface. It is at http://www.php.net. For + complex cases, many use the Perl interface and CGI.pm or mod_perl. + 2.3) Does PostgreSQL have a graphical user interface? Yes, there are + several graphical interfaces to PostgreSQL available. These include + PgAccess http://www.pgaccess.org www.pgaccess.org>), PgAdmin II + (http://www.pgadmin.org, Win32-only), RHDB Admin + (http://sources.redhat.com/rhdb/ ) and Rekall ( + http://www.thekompany.com/products/rekall/ + www.thekompany.com/products/rekall/>, proprietary). There is also + PHPPgAdmin ( http://phppgadmin.sourceforge.net/ + phppgadmin.sourceforge.net/>), a web-based interface to PostgreSQL. + See http://techdocs.postgresql.org/guides/GUITools for a more detailed + list. 2.4) What languages are able to communicate with PostgreSQL? + Most popular programming languages contain an interface to PostgreSQL. + Check your programming language's list of extension modules. The + following interfaces are included in the PostgreSQL distribution: * C + (libpq) * Embedded C (ecpg) * Java (jdbc) * Python (PyGreSQL) * TCL + (libpgtcl) Additional interfaces are available at + http://gborg.postgresql.org in the /Drivers/Interfaces/ section. + ---------------------------------------------------------------------- + -- Administrative Questions 3.1) How do I install PostgreSQL somewhere + other than //usr/local/pgsql/? Specify the /--prefix/ option when + running /configure/. 3.2) When I start /postmaster/, I get a /Bad + System Call/ or core dumped message. Why? It could be a variety of + problems, but first check to see that you have System V extensions + installed in your kernel. PostgreSQL requires kernel support for + shared memory and semaphores. 3.3) When I try to start /postmaster/, I + get /IpcMemoryCreate/ errors. Why? You either do not have shared + memory configured properly in your kernel or you need to enlarge the + shared memory available in the kernel. The exact amount you need + depends on your architecture and how many buffers and backend + processes you configure for /postmaster/. For most systems, with + default numbers of buffers and processes, you need a minimum of ~1 MB. + See the PostgreSQL Administrator's Guide + www.PostgreSQL.org/docs/view.php?version=current&idoc=1&file=kernel-re + sources.html> for more detailed information about shared memory and + semaphores. 3.4) When I try to start /postmaster/, I get + /IpcSemaphoreCreate/ errors. Why? If the error message is + /IpcSemaphoreCreate: semget failed (No space left on device)/ then + your kernel is not configured with enough semaphores. Postgres needs + one semaphore per potential backend process. A temporary solution is + to start /postmaster/ with a smaller limit on the number of backend + processes. Use /-N/ with a parameter less than the default of 32. A + more permanent solution is to increase your kernel's SEMMNS and SEMMNI + parameters. Inoperative semaphores can also cause crashes during heavy + database access. If the error message is something else, you might not + have semaphore support configured in your kernel at all. See the + PostgreSQL Administrator's Guide for more detailed information about + shared memory and semaphores. 3.5) How do I control connections from + other hosts? By default, PostgreSQL only allows connections from the + local machine using Unix domain sockets. Other machines will not be + able to connect unless you add the /-i/ flag to /postmaster/, *and* + enable host-based authentication by modifying the file + /$PGDATA/pg_hba.conf/ accordingly. This will allow TCP/IP connections. + 3.6) How do I tune the database engine for better performance? + Certainly, indexes can speed up queries. The EXPLAIN command allows + you to see how PostgreSQL is interpreting your query, and which + indexes are being used. If you are doing many INSERTs, consider doing + them in a large batch using the COPY command. This is much faster than + individual INSERTS. Second, statements not in a BEGIN WORK/COMMIT + transaction block are considered to be in their own transaction. + Consider performing several statements in a single transaction block. + This reduces the transaction overhead. Also, consider dropping and + recreating indexes when making large data changes. There are several + tuning options. You can disable /fsync()/ by starting /postmaster/ + with a /-o -F/ option. This will prevent /fsync()/s from flushing to + disk after every transaction. You can also use the /postmaster/ /-B/ + option to increase the number of shared memory buffers used by the + backend processes. If you make this parameter too high, the + /postmaster/ may not start because you have exceeded your kernel's + limit on shared memory space. Each buffer is 8K and the default is 64 + buffers. You can also use the backend /-S/ option to increase the + maximum amount of memory used by the backend process for temporary + sorts. The /-S/ value is measured in kilobytes, and the default is 512 + (i.e. 512K). You can also use the CLUSTER command to group data in + tables to match an index. See the CLUSTER manual page for more + details. 3.7) What debugging features are available? PostgreSQL has + several features that report status information that can be valuable + for debugging purposes. First, by running /configure/ with the + --enable-cassert option, many /assert()/s monitor the progress of the + backend and halt the program when something unexpected occurs. Both + /postmaster/ and /postgres/ have several debug options available. + First, whenever you start /postmaster/, make sure you send the + standard output and error to a log file, like: cd /usr/local/pgsql + ./bin/postmaster >server.log 2>&1 & This will put a server.log file in + the top-level PostgreSQL directory. This file contains useful + information about problems or errors encountered by the server. + /Postmaster/ has a /-d/ option that allows even more detailed + information to be reported. The /-d/ option takes a number that + specifies the debug level. Be warned that high debug level values + generate large log files. If /postmaster/ is not running, you can + actually run the /postgres/ backend from the command line, and type + your SQL statement directly. This is recommended *only* for debugging + purposes. Note that a newline terminates the query, not a semicolon. + If you have compiled with debugging symbols, you can use a debugger to + see what is happening. Because the backend was not started from + /postmaster/, it is not running in an identical environment and + locking/backend interaction problems may not be duplicated. If + /postmaster/ is running, start /psql/ in one window, then find the PID + of the /postgres/ process used by /psql/. Use a debugger to attach to + the /postgres/ PID. You can set breakpoints in the debugger and issue + queries from /psql/. If you are debugging /postgres/ startup, you can + set PGOPTIONS="-W n", then start /psql/. This will cause startup to + delay for /n/ seconds so you can attach to the process with the + debugger, set any breakpoints, and continue through the startup + sequence. The /postgres/ program has /-s, -A/, and /-t/ options that + can be very useful for debugging and performance measurements. You can + also compile with profiling to see what functions are taking execution + time. The backend profile files will be deposited in the + /pgsql/data/base/dbname/ directory. The client profile file will be + put in the client's current directory. Linux requires a compile with + /-DLINUX_PROFILE/ for proper profiling. 3.8) Why do I get /"Sorry, too + many clients"/ when trying to connect? You need to increase + /postmaster/'s limit on how many concurrent backend processes it can + start. The default limit is 32 processes. You can increase it by + restarting /postmaster/ with a suitable /-N/ value or modifying + /postgresql.conf/. Note that if you make /-N/ larger than 32, you must + also increase /-B/ beyond its default of 64; /-B/ must be at least + twice /-N/, and probably should be more than that for best + performance. For large numbers of backend processes, you are also + likely to find that you need to increase various Unix kernel + configuration parameters. Things to check include the maximum size of + shared memory blocks, SHMMAX; the maximum number of semaphores, SEMMNS + and SEMMNI; the maximum number of processes, NPROC; the maximum number + of processes per user, MAXUPRC; and the maximum number of open files, + NFILE and NINODE. The reason that PostgreSQL has a limit on the number + of allowed backend processes is so your system won't run out of + resources. 3.9) What is in the /pgsql_tmp/ directory? This directory + contains temporary files generated by the query executor. For example, + if a sort needs to be done to satisfy an ORDER BY and the sort + requires more space than the backend's /-S/ parameter allows, then + temporary files are created here to hold the extra data. The temporary + files are usually deleted automatically, but might remain if a backend + crashes during a sort. A stop and restart of the /postmaster/ will + remove files from those directories. 3.10) Why do I need to do a dump + and restore to upgrade between major PostgreSQL releases? The + PostgreSQL team makes only small changes between minor releases, so + upgrading from 7.2 to 7.2.1 does not require a dump and restore. + However, major releases (e.g. from 7.2 to 7.3) often change the + internal format of system tables and data files. These changes are + often complex, so we don't maintain backward compatability for data + files. A dump outputs data in a generic format that can then be loaded + in using the new internal format. In releases where the on-disk format + does not change, the /pg_upgrade/ script can be used to upgrade + without a dump/restore. The release notes mention whether /pg_upgrade/ + is available for the release. + ---------------------------------------------------------------------- + -- Operational Questions 4.1) What is the difference between binary + cursors and normal cursors? See the DECLARE manual page for a + description. 4.2) How do I SELECT only the first few rows of a query? + See the FETCH manual page, or use SELECT ... LIMIT.... The entire + query may have to be evaluated, even if you only want the first few + rows. Consider using a query that has an ORDER BY. If there is an + index that matches the ORDER BY, PostgreSQL may be able to evaluate + only the first few records requested, or the entire query may have to + be evaluated until the desired rows have been generated. 4.3) How do I + get a list of tables or other things I can see in /psql/? You can read + the source code for /psql/ in file /pgsql/src/bin/psql/describe.c/. It + contains SQL commands that generate the output for psql's backslash + commands. You can also start /psql/ with the /-E/ option so it will + print out the queries it uses to execute the commands you give. 4.4) + How do you remove a column from a table? This functionality was added + in release 7.3 with ALTER TABLE DROP COLUMN. In earlier versions, you + can do this: BEGIN; LOCK TABLE old_table; SELECT ... -- select all + columns but the one you want to remove INTO TABLE new_table FROM + old_table; DROP TABLE old_table; ALTER TABLE new_table RENAME TO + old_table; COMMIT; 4.5) What is the maximum size for a row, a table, + and a database? These are the limits: Maximum size for a database? + unlimited (4 TB databases exist) Maximum size for a table? 16 TB + Maximum size for a row? 1.6TB Maximum size for a field? 1 GB Maximum + number of rows in a table? unlimited Maximum number of columns in a + table? 250-1600 depending on column types Maximum number of indexes on + a table? unlimited Of course, these are not actually unlimited, but + limited to available disk space and memory/swap space. Performance may + suffer when these values get unusually large. The maximum table size + of 16 TB does not require large file support from the operating + system. Large tables are stored as multiple 1 GB files so file system + size limits are not important. The maximum table size and maximum + number of columns can be increased if the default block size is + increased to 32k. 4.6) How much database disk space is required to + store data from a typical text file? A PostgreSQL database may require + up to five times the disk space to store data from a text file. As an + example, consider a file of 100,000 lines with an integer and text + description on each line. Suppose the text string avergages twenty + bytes in length. The flat file would be 2.8 MB. The size of the + PostgreSQL database file containing this data can be estimated as 6.4 + MB: 36 bytes: each row header (approximate) 24 bytes: one int field + and one text field + 4 bytes: pointer on page to tuple + ---------------------------------------- 64 bytes per row The data + page size in PostgreSQL is 8192 bytes (8 KB), so: 8192 bytes per page + ------------------- = 128 rows per database page (rounded down) 64 + bytes per row 100000 data rows -------------------- = 782 database + pages (rounded up) 128 rows per page 782 database pages * 8192 bytes + per page = 6,406,144 bytes (6.4 MB) Indexes do not require as much + overhead, but do contain the data that is being indexed, so they can + be large also. NULLs are stored in bitmaps, so they use very little + space. 4.7) How do I find out what tables, indexes, databases, and + users are defined? /psql/ has a variety of backslash commands to show + such information. Use \? to see them. There are also system tables + beginning with /pg_/ that describe these too. Also, /psql -l/ will + list all databases. Also try the file + /pgsql/src/tutorial/syscat.source/. It illustrates many of the SELECTs + needed to get information from the database system tables. 4.8) My + queries are slow or don't make use of the indexes. Why? Indexes are + not automatically used by every query. Indexes are only used if the + table is larger than a minimum size, and the query selects only a + small percentage of the rows in the table. This is because the random + disk access caused by an index scan can be slower than a straight read + through the table, or sequential scan. To determine if an index should + be used, PostgreSQL must have statistics about the table. These + statistics are collected using VACUUM ANALYZE, or simply ANALYZE. + Using statistics, the optimizer knows how many rows are in the table, + and can better determine if indexes should be used. Statistics are + also valuable in determining optimal join order and join methods. + Statistics collection should be performed periodically as the contents + of the table change. Indexes are normally not used for ORDER BY or to + perform joins. A sequential scan followed by an explicit sort is + usually faster than an index scan of a large table. However, LIMIT + combined with ORDER BY often will use an index because only a small + portion of the table is returned. In fact, though MAX() and MIN() + don't use indexes, it is possible to retrieve such values using an + index with ORDER BY and LIMIT: SELECT col FROM tab ORDER BY col [ DESC + ] LIMIT 1; If you believe the optimizer is incorrect in choosing a + sequential scan, use |SET enable_seqscan TO 'off'| and run tests to + see if an index scan is indeed faster. When using wild-card operators + such as LIKE or /~/, indexes can only be used in certain + circumstances: * The beginning of the search string must be anchored + to the start of the string, i.e. o LIKE patterns must not start with + /%/. o /~/ (regular expression) patterns must start with /^/. * The + search string can not start with a character class, e.g. [a-e]. * + Case-insensitive searches such as ILIKE and /~*/ do not utilise + indexes. Instead, use functional indexes, which are described in + section 4.12 <#4.12>. * The default /C/ locale must be used during + /initdb/. 4.9) How do I see how the query optimizer is evaluating my + query? See the EXPLAIN manual page. 4.10) What is an R-tree index? An + R-tree index is used for indexing spatial data. A hash index can't + handle range searches. A B-tree index only handles range searches in a + single dimension. R-trees can handle multi-dimensional data. For + example, if an R-tree index can be built on an attribute of type + /point/, the system can more efficiently answer queries such as + "select all points within a bounding rectangle." The canonical paper + that describes the original R-tree design is: Guttman, A. "R-trees: A + Dynamic Index Structure for Spatial Searching." Proceedings of the + 1984 ACM SIGMOD Int'l Conf on Mgmt of Data, 45-57. You can also find + this paper in Stonebraker's "Readings in Database Systems". Built-in + R-trees can handle polygons and boxes. In theory, R-trees can be + extended to handle higher number of dimensions. In practice, extending + R-trees requires a bit of work and we don't currently have any + documentation on how to do it. 4.11) What is the Genetic Query + Optimizer? The GEQO module speeds query optimization when joining many + tables by means of a Genetic Algorithm (GA). It allows the handling of + large join queries through nonexhaustive search. 4.12) How do I + perform regular expression searches and case-insensitive regular + expression searches? How do I use an index for case-insensitive + searches? The /~/ operator does regular expression matching, and /~*/ + does case-insensitive regular expression matching. The + case-insensitive variant of LIKE is called ILIKE. Case-insensitive + equality comparisons are normally expressed as: SELECT * FROM tab + WHERE lower(col) = 'abc'; This will not use an standard index. + However, if you create a functional index, it will be used: CREATE + INDEX tabindex ON tab (lower(col)); 4.13) In a query, how do I detect + if a field is NULL? You test the column with IS NULL and IS NOT NULL. + 4.14) What is the difference between the various character types? Type + Internal Name Notes -------------------------------------------------- + VARCHAR(n) varchar size specifies maximum length, no padding CHAR(n) + bpchar blank padded to the specified fixed length TEXT text no + specific upper limit on length BYTEA bytea variable-length byte array + (null-byte safe) "char" char one character You will see the internal + name when examining system catalogs and in some error messages. The + first four types above are "varlena" types (i.e., the first four bytes + on disk are the length, followed by the data). Thus the actual space + used is slightly greater than the declared size. However, these data + types are also subject to compression or being stored out-of-line by + TOAST, so the space on disk might also be less than expected. + VARCHAR(n) is best when storing variable-length strings and it limits + how long a string can be. TEXT is for strings of unlimited length, + with a maximum of one gigabyte. CHAR(n) is for storing strings that + are all the same length. CHAR(n) pads with blanks to the specified + length, while VARCHAR(n) only stores the characters supplied. BYTEA is + for storing binary data, particularly values that include NULL bytes. + All the types described here have similar performance characteristics. + 4.15.1) How do I create a serial/auto-incrementing field? PostgreSQL + supports a SERIAL data type. It auto-creates a sequence and index on + the column. For example, this: CREATE TABLE person ( id SERIAL, name + TEXT ); is automatically translated into this: CREATE SEQUENCE + person_id_seq; CREATE TABLE person ( id INT4 NOT NULL DEFAULT + nextval('person_id_seq'), name TEXT ); CREATE UNIQUE INDEX + person_id_key ON person ( id ); See the /create_sequence/ manual page + for more information about sequences. You can also use each row's + /OID/ field as a unique value. However, if you need to dump and reload + the database, you need to use /pg_dump/'s /-o/ option or COPY WITH + OIDS option to preserve the OIDs. 4.15.2) How do I get the value of a + SERIAL insert? One approach is to retrieve the next SERIAL value from + the sequence object with the /nextval()/ function /before/ inserting + and then insert it explicitly. Using the example table in 4.15.1 + <#4.15.1>, an example in a pseudo-language would look like this: + new_id = execute("SELECT nextval('person_id_seq')"); execute("INSERT + INTO person (id, name) VALUES (new_id, 'Blaise Pascal')"); You would + then also have the new value stored in |new_id| for use in other + queries (e.g., as a foreign key to the |person| table). Note that the + name of the automatically created SEQUENCE object will be named + __/seq/, where /table/ and /serialcolumn/ are the names of your table + and your SERIAL column, respectively. Alternatively, you could + retrieve the assigned SERIAL value with the /currval()/ function + /after/ it was inserted by default, e.g., execute("INSERT INTO person + (name) VALUES ('Blaise Pascal')"); new_id = execute("SELECT + currval('person_id_seq')"); Finally, you could use the OID <#4.16> + returned from the INSERT statement to look up the default value, + though this is probably the least portable approach. In Perl, using + DBI with Edmund Mergl's DBD::Pg module, the oid value is made + available via /$sth->{pg_oid_status}/ after /$sth->execute()/. 4.15.3) + Don't /currval()/ and /nextval()/ lead to a race condition with other + users? No. /currval()/ returns the current value assigned by your + backend, not by all users. 4.15.4) Why aren't my sequence numbers + reused on transaction abort? Why are there gaps in the numbering of my + sequence/SERIAL column? To improve concurrency, sequence values are + given out to running transactions as needed and are not locked until + the transaction completes. This causes gaps in numbering from aborted + transactions. 4.16) What is an OID? What is a TID? OIDs are + PostgreSQL's answer to unique row ids. Every row that is created in + PostgreSQL gets a unique OID. All OIDs generated during /initdb/ are + less than 16384 (from /include/access/transam.h/). All user-created + OIDs are equal to or greater than this. By default, all these OIDs are + unique not only within a table or database, but unique within the + entire PostgreSQL installation. PostgreSQL uses OIDs in its internal + system tables to link rows between tables. These OIDs can be used to + identify specific user rows and used in joins. It is recommended you + use column type OID to store OID values. You can create an index on + the OID field for faster access. OIDs are assigned to all new rows + from a central area that is used by all databases. If you want to + change the OID to something else, or if you want to make a copy of the + table, with the original OIDs, there is no reason you can't do it: + CREATE TABLE new_table(old_oid oid, mycol int); SELECT old_oid, mycol + INTO new FROM old; COPY new TO '/tmp/pgtable'; DELETE FROM new; COPY + new WITH OIDS FROM '/tmp/pgtable'; OIDs are stored as 4-byte integers, + and will overflow at 4 billion. No one has reported this ever + happening, and we plan to have the limit removed before anyone does. + TIDs are used to identify specific physical rows with block and offset + values. TIDs change after rows are modified or reloaded. They are used + by index entries to point to physical rows. 4.17) What is the meaning + of some of the terms used in PostgreSQL? Some of the source code and + older documentation use terms that have more common usage. Here are + some: * table, relation, class * row, record, tuple * column, field, + attribute * retrieve, select * replace, update * append, insert * OID, + serial value * portal, cursor * range variable, table name, table + alias A list of general database terms can be found at: + http://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary + /glossary.html 4.18) Why do I get the error /"ERROR: Memory exhausted + in AllocSetAlloc()"/? You probably have run out of virtual memory on + your system, or your kernel has a low limit for certain resources. Try + this before starting /postmaster/: ulimit -d 262144 limit datasize + 256m Depending on your shell, only one of these may succeed, but it + will set your process data segment limit much higher and perhaps allow + the query to complete. This command applies to the current process, + and all subprocesses created after the command is run. If you are + having a problem with the SQL client because the backend is returning + too much data, try it before starting the client. 4.19) How do I tell + what PostgreSQL version I am running? From /psql/, type |SELECT + version();| 4.20) Why does my large-object operations get /"invalid + large obj descriptor"/? You need to put |BEGIN WORK| and |COMMIT| + around any use of a large object handle, that is, surrounding + |lo_open| ... |lo_close.| Currently PostgreSQL enforces the rule by + closing large object handles at transaction commit. So the first + attempt to do anything with the handle will draw /invalid large obj + descriptor/. So code that used to work (at least most of the time) + will now generate that error message if you fail to use a transaction. + If you are using a client interface like ODBC you may need to set + |auto-commit off.| 4.21) How do I create a column that will default to + the current time? Use /CURRENT_TIMESTAMP/: |CREATE TABLE test (x int, + modtime timestamp DEFAULT CURRENT_TIMESTAMP ); | 4.22) Why are my + subqueries using |IN| so slow? Currently, we join subqueries to outer + queries by sequentially scanning the result of the subquery for each + row of the outer query. If the subquery returns only a few rows and + the outer query returns many rows, |IN| is fastest. To speed up other + queries, replace |IN| with |EXISTS|: SELECT * FROM tab WHERE col IN + (SELECT subcol FROM subtab); to: SELECT * FROM tab WHERE EXISTS + (SELECT subcol FROM subtab WHERE subcol = col); For this to be fast, + |subcol| should be an indexed column. This preformance problem will be + fixed in 7.4. 4.23) How do I perform an outer join? PostgreSQL + supports outer joins using the SQL standard syntax. Here are two + examples: SELECT * FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col); or + SELECT * FROM t1 LEFT OUTER JOIN t2 USING (col); These identical + queries join t1.col to t2.col, and also return any unjoined rows in t1 + (those with no match in t2). A RIGHT join would add unjoined rows of + t2. A FULL join would return the matched rows plus all unjoined rows + from t1 and t2. The word OUTER is optional and is assumed in LEFT, + RIGHT, and FULL joins. Ordinary joins are called INNER joins. In + previous releases, outer joins can be simulated using UNION and NOT + IN. For example, when joining /tab1/ and /tab2/, the following query + does an /outer/ join of the two tables: SELECT tab1.col1, tab2.col2 + FROM tab1, tab2 WHERE tab1.col1 = tab2.col1 UNION ALL SELECT + tab1.col1, NULL FROM tab1 WHERE tab1.col1 NOT IN (SELECT tab2.col1 + FROM tab2) ORDER BY col1 4.24) How do I perform queries using multiple + databases? There is no way to query a database other than the current + one. Because PostgreSQL loads database-specific system catalogs, it is + uncertain how a cross-database query should even behave. + /contrib/dblink/ allows cross-database queries using function calls. + Of course, a client can make simultaneous connections to different + databases and merge the results on the client side. 4.25) How do I + return multiple rows or columns from a function? In 7.3, you can + easily return multiple rows or columns from a function, + http://techdocs.postgresql.org/guides/SetReturningFunctions + techdocs.postgresql.org/guides/SetReturningFunctions>. 4.26) Why can't + I reliably create/drop temporary tables in PL/PgSQL functions? + PL/PgSQL caches function contents, and an unfortunate side effect is + that if a PL/PgSQL function accesses a temporary table, and that table + is later dropped and recreated, and the function called again, the + function will fail because the cached function contents still point to + the old temporary table. The solution is to use EXECUTE for temporary + table access in PL/PgSQL. This will cause the query to be reparsed + every time. 4.27) What replication options are available? There are + several master/slave replication options available. These allow only + the master to make database changes and the slave can only do database + reads. The bottom of + http://gborg.PostgreSQL.org/genpage?replication_research + gborg.PostgreSQL.org/genpage?replication_research> lists them. A + multi-master replication solution is being worked on at + http://gborg.PostgreSQL.org/project/pgreplication/projdisplay.php. + 4.28) What encryption options are available? * /contrib/pgcrypto/ + contains many encryption functions for use in SQL queries. * The only + way to encrypt transmission from the client to the server is by using + /hostssl/ in /pg_hba.conf/. * Database user passwords are + automatically encrypted when stored in version 7.3. In previous + versions, you must enable the option /PASSWORD_ENCRYPTION/ in + /postgresql.conf/. * The server can run using an encrypted file + system. + ---------------------------------------------------------------------- + -- Extending PostgreSQL 5.1) I wrote a user-defined function. When I + run it in /psql/, why does it dump core? The problem could be a number + of things. Try testing your user-defined function in a stand-alone + test program first. 5.2) How can I contribute some nifty new types and + functions to PostgreSQL? Send your extensions to the /pgsql-hackers/ + mailing list, and they will eventually end up in the /contrib// + subdirectory. 5.3) How do I write a C function to return a tuple? In + versions of PostgreSQL beginning with 7.3, table-returning functions + are fully supported in C, PL/PgSQL, and SQL. See the Programmer's + Guide for more information. An example of a table-returning function + defined in C can be found in /contrib/tablefunc/. 5.4) I have changed + a source file. Why does the recompile not see the change? The + /Makefiles/ do not have the proper dependencies for include files. You + have to do a /make clean/ and then another /make/. If you are using + GCC you can use the /--enable-depend/ option of /configure/ to have + the compiler compute the dependencies automatically. diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html index 54fc1b724f9..82eed3c326d 100644 --- a/doc/src/FAQ/FAQ.html +++ b/doc/src/FAQ/FAQ.html @@ -10,7 +10,7 @@ alink="#0000ff"> <H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1> - <P>Last updated: Wed Jul 23 00:11:07 EDT 2003</P> + <P>Last updated: Wed Jul 23 12:53:27 EDT 2003</P> <P>Current maintainer: Bruce Momjian (<A href= "mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR> @@ -325,7 +325,7 @@ <P>The latest release of PostgreSQL is version 7.3.4.</P> - <P>We plan to have major releases every four months.</P> + <P>We plan to have major releases every six to eight months.</P> <H4><A name="1.8">1.8</A>) What documentation is available?</H4> diff --git a/doc/src/FAQ/FAQ_german.html b/doc/src/FAQ/FAQ_german.html index 73ccae56eab..60752bcb5b2 100644 --- a/doc/src/FAQ/FAQ_german.html +++ b/doc/src/FAQ/FAQ_german.html @@ -14,7 +14,7 @@ href="mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</a>).</p> <p>Deutsche �bersetzung von Ian Barwick (<a href="mailto:barwick@gmx.net">barwick@gmx.net</a>).</p> - <p>Letzte Aktualisierung der deutschen �bersetzung: Mo., den 02.06.2003, 22:00 CET</p> + <p>Letzte Aktualisierung der deutschen �bersetzung: Di., den 22.07.2003, 16:20 CET</p> <p>Die aktuellste Version dieses Dokuments liegt auf der PostgreSQL Website:</p> <ul> @@ -279,14 +279,14 @@ href="mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</a>).</p> <p>Eine Liste von Unternehmen, die Support f�r PostgreSQL auf kommerzieller Basis leisten, kann unter - <a href="http://www.ca.PostgreSQL.org/users-lounge/commercial-support.html">http://www.ca.PostgreSQL.org/users-lounge/commercial-support.html</a> + <a href="http://techdocs.postgresql.org/companies.php">http://techdocs.postgresql.org/companies.php</a> eingesehen werden.</p> <h4><a name="1.7">1.7</a>) Was ist die neueste Version von PostgreSQL?</h4> - <p>Die neueste Version von PostgreSQL ist 7.3.3 .</p> + <p>Die neueste Version von PostgreSQL ist 7.3.4 .</p> - <p>Wir planen alle 4 Monate eine neue Version herauszugeben.</p> + <p>Die Freigabe einer neuen Version erfolgt im Schnitt ca. dreimal pro Jahr.</p> <h4><a name="1.8">1.8</a>) Welche Dokumentation ist f�r PostgreSQL verf�gbar?</h4> diff --git a/doc/src/FAQ/FAQ_turkish.html b/doc/src/FAQ/FAQ_turkish.html new file mode 100644 index 00000000000..38944666bb8 --- /dev/null +++ b/doc/src/FAQ/FAQ_turkish.html @@ -0,0 +1,1255 @@ +
+ PostgreSQL i�in S�k�a Sorulan Sorular (SSS)
+
+Son g�ncelleme : 19 May�s 2003 Pazartesi - 03:05:21
+
+Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us
+<mailto:pgman@candle.pha.pa.us>)
+
+�eviren : Devrim G�ND�Z (devrim@gunduz.org <mailto:devrim@gunduz.org>)
+Nicolai Tufar (ntufar@yahoo.com <mailto:ntufar@yahoo.com>)
+
+Bu belgenin en g�ncel hali,
+http://www.PostgreSQL.org/docs/faqs/FAQ_turkish.html ve
+http://www.gunduz.org/seminer/pg/FAQ_turkish adreslerinde g�r�lebilir.
+
+Platforma �zel sorular�n�z,http://www.PostgreSQL.org/docs/index.html
+adresinde yan�tlan�r..
+
+------------------------------------------------------------------------
+
+
+ Genel Sorular
+
+1.1 <#1.1>) PostgreSQL nedir? Nas�l okunur?
+1.2 <#1.2>) PostgreSQL' in haklar� nedir?
+1.3 <#1.3>) PostgreSQL, hangi Unix platformlar�nda �al�s�r?
+1.4 <#1.4>) Hangi Unix olmayan uyarlamalar� bulunmaktad�r?
+1.5 <#1.5>) PostgreSQL'i nereden indirebilirim?
+1.6 <#1.6>) Deste�i nereden alabilirim?
+1.7 <#1.7>) En son s�r�m� nedir?
+1.8 <#1.8>) Hangi belgelere ulasabilirim?
+1.9 <#1.9>) Bilinen hatalar ya da eksik �zelliklere nereden ulasabilirim?
+1.10 <#1.10>) Nas�l SQL ��renebilirim?
+1.11 <#1.11>) PostgreSQL 2000 y�l�na uyumlu mudur?
+1.12 <#1.12>) Geli�tirme tak�m�na nas�l kat�labilirim??
+1.13 <#1.13>) Bir hata raporunu nas�l g�nderebilirim?
+1.14 <#1.14>) PostgreSQL, diger VTYS(DBMS lerle nas�l kar��la�t�r�labilir?
+1.15 <#1.15>) PostgreSQL'e maddi a��dan nas�l destek olabilirim?
+
+
+ Kullan�c�/istemci Sorular�
+
+2.1 <#2.1>) Are there ODBC drivers for PostgreSQL?
+2.2 <#2.2>) What tools are available for using PostgreSQL with Web pages?
+2.3 <#2.3>) Does PostgreSQL have a graphical user interface?
+2.4 <#2.4>) What languages are available to communicate with PostgreSQL?
+
+
+ Administrative Questions
+
+3.1 <#3.1>) How do I install PostgreSQL somewhere other than
+//usr/local/pgsql/?
+3.2 <#3.2>) When I start /postmaster/, I get a /Bad System Call/ or core
+dumped message. Why?
+3.3 <#3.3>) When I try to start /postmaster/, I get /IpcMemoryCreate/
+errors. Why?
+3.4 <#3.4>) When I try to start /postmaster/, I get /IpcSemaphoreCreate/
+errors. Why?
+3.5 <#3.5>) How do I control connections from other hosts?
+3.6 <#3.6>) How do I tune the database engine for better performance?
+3.7 <#3.7>) What debugging features are available?
+3.8 <#3.8>) Why do I get /"Sorry, too many clients"/ when trying to connect?
+3.9 <#3.9>) What is in the /pgsql_tmp/ directory?
+3.10 <#3.10>) Why do I need to do a dump and restore to upgrade
+PostgreSQL releases?
+
+
+ Operational Questions
+
+4.1 <#4.1>) What is the difference between binary cursors and normal
+cursors?
+4.2 <#4.2>) How do I SELECT only the first few rows of a query?
+4.3 <#4.3>) How do I get a list of tables or other things I can see in
+/psql/?
+4.4 <#4.4>) How do you remove a column from a table?
+4.5 <#4.5>) What is the maximum size for a row, a table, and a database?
+4.6 <#4.6>) How much database disk space is required to store data from
+a typical text file?
+4.7 <#4.7>) How do I find out what tables, indexes, databases, and users
+are defined?
+4.8 <#4.8>) My queries are slow or don't make use of the indexes. Why?
+4.9 <#4.9>) How do I see how the query optimizer is evaluating my query?
+4.10 <#4.10>) What is an R-tree index?
+4.11 <#4.11>) What is the Genetic Query Optimizer?
+4.12 <#4.12>) How do I perform regular expression searches and
+case-insensitive regular expression searches? How do I use an index for
+case-insensitive searches?
+4.13 <#4.13>) In a query, how do I detect if a field is NULL?
+4.14 <#4.14>) What is the difference between the various character types?
+4.15.1 <#4.15.1>) How do I create a serial/auto-incrementing field?
+4.15.2 <#4.15.2>) How do I get the value of a SERIAL insert?
+4.15.3 <#4.15.3>) Don't /currval()/ and /nextval()/ lead to a race
+condition with other users?
+4.15.4 <#4.15.4>) Why aren't my sequence numbers reused on transaction
+abort? Why are there gaps in the numbering of my sequence/SERIAL column?
+4.16 <#4.16>) What is an OID? What is a TID?
+4.17 <#4.17>) What is the meaning of some of the terms used in PostgreSQL?
+4.18 <#4.18>) Why do I get the error /"ERROR: Memory exhausted in
+AllocSetAlloc()"/?
+4.19 <#4.19>) How do I tell what PostgreSQL version I am running?
+4.20 <#4.20>) Why does my large-object operations get /"invalid large
+obj descriptor"/?
+4.21 <#4.21>) How do I create a column that will default to the current
+time?
+4.22 <#4.22>) Why are my subqueries using |IN| so slow?
+4.23 <#4.23>) How do I perform an outer join?
+4.24 <#4.24>) How do I perform queries using multiple databases?
+4.25 <#4.25>) How do I return multiple rows or columns from a function?
+4.26 <#4.26>) Why can't I reliably create/drop temporary tables in
+PL/PgSQL functions?
+4.27 <#4.27>) What replication options are available?
+4.28 <#4.28>) What encryption options are available?
+
+
+ Extending PostgreSQL
+
+5.1 <#5.1>) I wrote a user-defined function. When I run it in /psql/,
+why does it dump core?
+5.2 <#5.2>) How can I contribute some nifty new types and functions to
+PostgreSQL?
+5.3 <#5.3>) How do I write a C function to return a tuple?
+5.4 <#5.4>) I have changed a source file. Why does the recompile not see
+the change?
+------------------------------------------------------------------------
+
+
+ General Questions
+
+
+ 1.1) What is PostgreSQL? How is it pronounced?
+
+PostgreSQL is pronounced /Post-Gres-Q-L/.
+
+PostgreSQL is an enhancement of the POSTGRES database management system,
+a next-generation DBMS research prototype. While PostgreSQL retains the
+powerful data model and rich data types of POSTGRES, it replaces the
+PostQuel query language with an extended subset of SQL. PostgreSQL is
+free and the complete source is available.
+
+PostgreSQL development is performed by a team of developers who all
+subscribe to the PostgreSQL development mailing list. The current
+coordinator is Marc G. Fournier (scrappy@PostgreSQL.org
+<mailto:scrappy@PostgreSQL.org>). (See section 1.6 <#1.6> on how to
+join). This team is now responsible for all development of PostgreSQL.
+
+The authors of PostgreSQL 1.01 were Andrew Yu and Jolly Chen. Many
+others have contributed to the porting, testing, debugging, and
+enhancement of the code. The original Postgres code, from which
+PostgreSQL is derived, was the effort of many graduate students,
+undergraduate students, and staff programmers working under the
+direction of Professor Michael Stonebraker at the University of
+California, Berkeley.
+
+The original name of the software at Berkeley was Postgres. When SQL
+functionality was added in 1995, its name was changed to Postgres95. The
+name was changed at the end of 1996 to PostgreSQL.
+
+
+ 1.2) What is the copyright on PostgreSQL?
+
+PostgreSQL is subject to the following COPYRIGHT:
+
+PostgreSQL Data Base Management System
+
+Portions copyright (c) 1996-2002, PostgreSQL Global Development Group
+Portions Copyright (c) 1994-6 Regents of the University of California
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written
+agreement is hereby granted, provided that the above copyright notice
+and this paragraph and the following two paragraphs appear in all copies.
+
+IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+
+THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
+TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+The above is the BSD license, the classic open-source license. It has no
+restrictions on how the source code may be used. We like it and have no
+intention of changing it.
+
+
+ 1.3) What Unix platforms does PostgreSQL run on?
+
+In general, a modern Unix-compatible platform should be able to run
+PostgreSQL. The platforms that had received explicit testing at the time
+of release are listed in the installation instructions.
+
+
+ 1.4) What non-Unix ports are available?
+
+*Client*
+
+It is possible to compile the /libpq/ C library, psql, and other
+interfaces and client applications to run on MS Windows platforms. In
+this case, the client is running on MS Windows, and communicates via
+TCP/IP to a server running on one of our supported Unix platforms. A
+file /win32.mak/ is included in the distribution for making a Win32
+/libpq/ library and /psql/. PostgreSQL also communicates with ODBC clients.
+
+*Server*
+
+The database server can run on Windows NT and Win2k using Cygwin, the
+Cygnus Unix/NT porting library. See /pgsql/doc/FAQ_MSWIN/ in the
+distribution or the MS Windows FAQ at
+http://www.PostgreSQL.org/docs/faqs/text/FAQ_MSWIN
+<http://www.PostgreSQL.org/docs/faqs/text/FAQ_MSWIN>.
+
+A native port to MS Win NT/2000/XP is currently being worked on. For
+more details on the current status of PostgreSQL on Windows see
+http://techdocs.postgresql.org/guides/Windows
+<http://techdocs.postgresql.org/guides/Windows>.
+
+There is also a Novell Netware 6 port at http://forge.novell.com.
+
+
+ 1.5) Where can I get PostgreSQL?
+
+The primary anonymous ftp site for PostgreSQL is
+ftp://ftp.PostgreSQL.org/pub. For mirror sites, see our main web site.
+
+
+ 1.6) Where can I get support?
+
+The main mailing list is: pgsql-general@PostgreSQL.org
+<mailto:pgsql-general@PostgreSQL.org>. It is available for discussion of
+matters pertaining to PostgreSQL. To subscribe, send mail with the
+following lines in the body (not the subject line):
+
+ subscribe
+ end
+
+to pgsql-general-request@PostgreSQL.org
+<mailto:pgsql-general-request@PostgreSQL.org>.
+
+There is also a digest list available. To subscribe to this list, send
+email to: pgsql-general-digest-request@PostgreSQL.org
+<mailto:pgsql-general-digest-request@PostgreSQL.org> with a body of:
+
+ subscribe
+ end
+
+Digests are sent out to members of this list whenever the main list has
+received around 30k of messages.
+
+The bugs mailing list is available. To subscribe to this list, send
+email to pgsql-bugs-request@PostgreSQL.org
+<mailto:pgsql-bugs-request@PostgreSQL.org> with a body of:
+
+ subscribe
+ end
+
+There is also a developers discussion mailing list available. To
+subscribe to this list, send email to
+pgsql-hackers-request@PostgreSQL.org
+<mailto:pgsql-hackers-request@PostgreSQL.org> with a body of:
+
+ subscribe
+ end
+
+Additional mailing lists and information about PostgreSQL can be found
+via the PostgreSQL WWW home page at:
+
+ http://www.PostgreSQL.org
+
+There is also an IRC channel on EFNet and OpenProjects, channel
+/#PostgreSQL/. I use the Unix command |irc -c '#PostgreSQL' "$USER"
+irc.phoenix.net.|
+
+A list of commercial support companies is available at
+http://www.ca.PostgreSQL.org/users-lounge/commercial-support.html.
+
+
+ 1.7) What is the latest release?
+
+The latest release of PostgreSQL is version 7.3.3.
+
+We plan to have major releases every four months.
+
+
+ 1.8) What documentation is available?
+
+Several manuals, manual pages, and some small test examples are included
+in the distribution. See the //doc/ directory. You can also browse the
+manuals online at http://www.PostgreSQL.org/docs.
+
+There are two PostgreSQL books available online at
+http://www.PostgreSQL.org/docs/awbook.html and
+http://www.commandprompt.com/ppbook/. There is a list of PostgreSQL
+books available for purchase at http://www.ca.PostgreSQL.org/books/.
+There is also a collection of PostgreSQL technical articles at
+http://techdocs.PostgreSQL.org/.
+
+/psql/ has some nice \d commands to show information about types,
+operators, functions, aggregates, etc.
+
+Our web site contains even more documentation.
+
+
+ 1.9) How do I find out about known bugs or missing features?
+
+PostgreSQL supports an extended subset of SQL-92. See our TODO
+<http://developer.PostgreSQL.org/todo.php> list for known bugs, missing
+features, and future plans.
+
+
+ 1.10) How can I learn SQL?
+
+The PostgreSQL book at http://www.PostgreSQL.org/docs/awbook.html
+teaches SQL. There is another PostgreSQL book at
+http://www.commandprompt.com/ppbook.
+<http://www.commandprompt.com/ppbook/> There is a nice tutorial at
+http://www.intermedia.net/support/sql/sqltut.shtm,
+<http://www.intermedia.net/support/sql/sqltut.shtm> at
+http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM,
+<http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM>
+and at http://sqlcourse.com. <http://sqlcourse.com/>
+
+Another one is "Teach Yourself SQL in 21 Days, Second Edition" at
+http://members.tripod.com/er4ebus/sql/index.htm
+
+Many of our users like /The Practical SQL Handbook/, Bowman, Judith S.,
+et al., Addison-Wesley. Others like /The Complete Reference SQL/, Groff
+et al., McGraw-Hill.
+
+
+ 1.11) Is PostgreSQL Y2K compliant?
+
+Yes, we easily handle dates past the year 2000 AD, and before 2000 BC.
+
+
+ 1.12) How do I join the development team?
+
+First, download the latest source and read the PostgreSQL Developers
+documentation on our web site, or in the distribution. Second, subscribe
+to the /pgsql-hackers/ and /pgsql-patches/ mailing lists. Third, submit
+high quality patches to pgsql-patches.
+
+There are about a dozen people who have commit privileges to the
+PostgreSQL CVS archive. They each have submitted so many high-quality
+patches that it was impossible for the existing committers to keep up,
+and we had confidence that patches they committed were of high quality.
+
+
+ 1.13) How do I submit a bug report?
+
+Please visit the PostgreSQL BugTool page at
+http://www.PostgreSQL.org/bugs/bugs.php, which gives guidelines and
+directions on how to submit a bug report.
+
+Also check out our ftp site ftp://ftp.PostgreSQL.org/pub to see if there
+is a more recent PostgreSQL version or patches.
+
+
+ 1.14) How does PostgreSQL compare to other DBMSs?
+
+There are several ways of measuring software: features, performance,
+reliability, support, and price.
+
+*Features*
+ PostgreSQL has most features present in large commercial DBMSs, like
+ transactions, subselects, triggers, views, foreign key referential
+ integrity, and sophisticated locking. We have some features they do
+ not have, like user-defined types, inheritance, rules, and
+ multi-version concurrency control to reduce lock contention.
+
+*Performance*
+ PostgreSQL has performance similar to other commercial and open
+ source databases. it is faster for some things, slower for others.
+ In comparison to MySQL or leaner database systems, we are slower on
+ inserts/updates because of transaction overhead. Of course, MySQL
+ does not have any of the features mentioned in the /Features/
+ section above. We are built for reliability and features, though we
+ continue to improve performance in every release. There is an
+ interesting Web page comparing PostgreSQL to MySQL at
+ http://openacs.org/philosophy/why-not-mysql.html
+ <http://openacs.org/philosophy/why-not-mysql.html>
+
+*Reliability*
+ We realize that a DBMS must be reliable, or it is worthless. We
+ strive to release well-tested, stable code that has a minimum of
+ bugs. Each release has at least one month of beta testing, and our
+ release history shows that we can provide stable, solid releases
+ that are ready for production use. We believe we compare favorably
+ to other database software in this area.
+
+*Support*
+ Our mailing lists provide contact with a large group of developers
+ and users to help resolve any problems encountered. While we cannot
+ guarantee a fix, commercial DBMSs do not always supply a fix either.
+ Direct access to developers, the user community, manuals, and the
+ source code often make PostgreSQL support superior to other DBMSs.
+ There is commercial per-incident support available for those who
+ need it. (See FAQ section 1.6 <#1.6>.)
+
+*Price*
+ We are free for all use, both commercial and non-commercial. You can
+ add our code to your product with no limitations, except those
+ outlined in our BSD-style license stated above.
+
+
+ 1.15) How can I financially assist PostgreSQL?
+
+PostgreSQL has had a first-class infrastructure since we started in
+1996. This is all thanks to Marc Fournier, who has created and managed
+this infrastructure over the years.
+
+Quality infrastructure is very important to an open-source project. It
+prevents disruptions that can greatly delay forward movement of the project.
+
+Of course, this infrastructure is not cheap. There are a variety of
+monthly and one-time expenses that are required to keep it going. If you
+or your company has money it can donate to help fund this effort, please
+go to http://store.pgsql.com/shopping/ and make a donation.
+
+Although the web page mentions PostgreSQL, Inc, the "contributions" item
+is solely to support the PostgreSQL project and does not fund any
+specific company. If you prefer, you can also send a check to the
+contact address.
+
+------------------------------------------------------------------------
+
+
+ User Client Questions
+
+
+ 2.1) Are there ODBC drivers for PostgreSQL?
+
+There are two ODBC drivers available, PsqlODBC and OpenLink ODBC.
+
+You can download PsqlODBC from
+http://gborg.postgresql.org/project/psqlodbc/projdisplay.php
+<http://gborg.postgresql.org/project/psqlodbc/projdisplay.php>.
+
+OpenLink ODBC can be gotten from http://www.openlinksw.com
+<http://www.openlinksw.com/>. It works with their standard ODBC client
+software so you'll have PostgreSQL ODBC available on every client
+platform they support (Win, Mac, Unix, VMS).
+
+They will probably be selling this product to people who need
+commercial-quality support, but a freeware version will always be
+available. Please send questions to postgres95@openlink.co.uk
+<mailto:postgres95@openlink.co.uk>.
+
+
+ 2.2) What tools are available for using PostgreSQL with Web pages?
+
+A nice introduction to Database-backed Web pages can be seen at:
+http://www.webreview.com
+
+For Web integration, PHP is an excellent interface. It is at
+http://www.php.net.
+
+For complex cases, many use the Perl interface and CGI.pm or mod_perl.
+
+
+ 2.3) Does PostgreSQL have a graphical user interface?
+
+Yes, there are several graphical interfaces to PostgreSQL available.
+These include PgAccess http://www.pgaccess.org
+<http://www.pgaccess.org>), PgAdmin II (http://www.pgadmin.org,
+Win32-only), RHDB Admin (http://sources.redhat.com/rhdb/ ) and Rekall (
+http://www.thekompany.com/products/rekall/
+<http://www.thekompany.com/products/rekall/>, proprietary). There is
+also PHPPgAdmin ( http://phppgadmin.sourceforge.net/
+<http://phppgadmin.sourceforge.net/>), a web-based interface to PostgreSQL.
+
+See http://techdocs.postgresql.org/guides/GUITools for a more detailed list.
+
+
+ 2.4) What languages are able to communicate with PostgreSQL?
+
+Most popular programming languages contain an interface to PostgreSQL.
+Check your programming language's list of extension modules.
+
+The following interfaces are included in the PostgreSQL distribution:
+
+ * C (libpq)
+ * Embedded C (ecpg)
+ * Java (jdbc)
+ * Python (PyGreSQL)
+ * TCL (libpgtcl)
+
+Additional interfaces are available at http://gborg.postgresql.org in
+the /Drivers/Interfaces/ section.
+
+------------------------------------------------------------------------
+
+
+ Administrative Questions
+
+
+ 3.1) How do I install PostgreSQL somewhere other than
+ //usr/local/pgsql/?
+
+Specify the /--prefix/ option when running /configure/.
+
+
+ 3.2) When I start /postmaster/, I get a /Bad System Call/ or
+ core dumped message. Why?
+
+It could be a variety of problems, but first check to see that you have
+System V extensions installed in your kernel. PostgreSQL requires kernel
+support for shared memory and semaphores.
+
+
+ 3.3) When I try to start /postmaster/, I get /IpcMemoryCreate/
+ errors. Why?
+
+You either do not have shared memory configured properly in your kernel
+or you need to enlarge the shared memory available in the kernel. The
+exact amount you need depends on your architecture and how many buffers
+and backend processes you configure for /postmaster/. For most systems,
+with default numbers of buffers and processes, you need a minimum of ~1
+MB. See the PostgreSQL Administrator's Guide
+<http://www.PostgreSQL.org/docs/view.php?version=current&idoc=1&file=kernel-resources.html>
+for more detailed information about shared memory and semaphores.
+
+
+ 3.4) When I try to start /postmaster/, I get
+ /IpcSemaphoreCreate/ errors. Why?
+
+If the error message is /IpcSemaphoreCreate: semget failed (No space
+left on device)/ then your kernel is not configured with enough
+semaphores. Postgres needs one semaphore per potential backend process.
+A temporary solution is to start /postmaster/ with a smaller limit on
+the number of backend processes. Use /-N/ with a parameter less than the
+default of 32. A more permanent solution is to increase your kernel's
+SEMMNS and SEMMNI parameters.
+
+Inoperative semaphores can also cause crashes during heavy database access.
+
+If the error message is something else, you might not have semaphore
+support configured in your kernel at all. See the PostgreSQL
+Administrator's Guide for more detailed information about shared memory
+and semaphores.
+
+
+ 3.5) How do I control connections from other hosts?
+
+By default, PostgreSQL only allows connections from the local machine
+using Unix domain sockets. Other machines will not be able to connect
+unless you add the /-i/ flag to /postmaster/, *and* enable host-based
+authentication by modifying the file /$PGDATA/pg_hba.conf/ accordingly.
+This will allow TCP/IP connections.
+
+
+ 3.6) How do I tune the database engine for better performance?
+
+Certainly, indexes can speed up queries. The EXPLAIN command allows you
+to see how PostgreSQL is interpreting your query, and which indexes are
+being used.
+
+If you are doing many INSERTs, consider doing them in a large batch
+using the COPY command. This is much faster than individual INSERTS.
+Second, statements not in a BEGIN WORK/COMMIT transaction block are
+considered to be in their own transaction. Consider performing several
+statements in a single transaction block. This reduces the transaction
+overhead. Also, consider dropping and recreating indexes when making
+large data changes.
+
+There are several tuning options. You can disable /fsync()/ by starting
+/postmaster/ with a /-o -F/ option. This will prevent /fsync()/s from
+flushing to disk after every transaction.
+
+You can also use the /postmaster/ /-B/ option to increase the number of
+shared memory buffers used by the backend processes. If you make this
+parameter too high, the /postmaster/ may not start because you have
+exceeded your kernel's limit on shared memory space. Each buffer is 8K
+and the default is 64 buffers.
+
+You can also use the backend /-S/ option to increase the maximum amount
+of memory used by the backend process for temporary sorts. The /-S/
+value is measured in kilobytes, and the default is 512 (i.e. 512K).
+
+You can also use the CLUSTER command to group data in tables to match an
+index. See the CLUSTER manual page for more details.
+
+
+ 3.7) What debugging features are available?
+
+PostgreSQL has several features that report status information that can
+be valuable for debugging purposes.
+
+First, by running /configure/ with the --enable-cassert option, many
+/assert()/s monitor the progress of the backend and halt the program
+when something unexpected occurs.
+
+Both /postmaster/ and /postgres/ have several debug options available.
+First, whenever you start /postmaster/, make sure you send the standard
+output and error to a log file, like:
+
+ cd /usr/local/pgsql
+ ./bin/postmaster >server.log 2>&1 &
+
+This will put a server.log file in the top-level PostgreSQL directory.
+This file contains useful information about problems or errors
+encountered by the server. /Postmaster/ has a /-d/ option that allows
+even more detailed information to be reported. The /-d/ option takes a
+number that specifies the debug level. Be warned that high debug level
+values generate large log files.
+
+If /postmaster/ is not running, you can actually run the /postgres/
+backend from the command line, and type your SQL statement directly.
+This is recommended *only* for debugging purposes. Note that a newline
+terminates the query, not a semicolon. If you have compiled with
+debugging symbols, you can use a debugger to see what is happening.
+Because the backend was not started from /postmaster/, it is not running
+in an identical environment and locking/backend interaction problems may
+not be duplicated.
+
+If /postmaster/ is running, start /psql/ in one window, then find the
+PID of the /postgres/ process used by /psql/. Use a debugger to attach
+to the /postgres/ PID. You can set breakpoints in the debugger and issue
+queries from /psql/. If you are debugging /postgres/ startup, you can
+set PGOPTIONS="-W n", then start /psql/. This will cause startup to
+delay for /n/ seconds so you can attach to the process with the
+debugger, set any breakpoints, and continue through the startup sequence.
+
+The /postgres/ program has /-s, -A/, and /-t/ options that can be very
+useful for debugging and performance measurements.
+
+You can also compile with profiling to see what functions are taking
+execution time. The backend profile files will be deposited in the
+/pgsql/data/base/dbname/ directory. The client profile file will be put
+in the client's current directory. Linux requires a compile with
+/-DLINUX_PROFILE/ for proper profiling.
+
+
+ 3.8) Why do I get /"Sorry, too many clients"/ when trying to
+ connect?
+
+You need to increase /postmaster/'s limit on how many concurrent backend
+processes it can start.
+
+The default limit is 32 processes. You can increase it by restarting
+/postmaster/ with a suitable /-N/ value or modifying /postgresql.conf/.
+
+Note that if you make /-N/ larger than 32, you must also increase /-B/
+beyond its default of 64; /-B/ must be at least twice /-N/, and probably
+should be more than that for best performance. For large numbers of
+backend processes, you are also likely to find that you need to increase
+various Unix kernel configuration parameters. Things to check include
+the maximum size of shared memory blocks, SHMMAX; the maximum number of
+semaphores, SEMMNS and SEMMNI; the maximum number of processes, NPROC;
+the maximum number of processes per user, MAXUPRC; and the maximum
+number of open files, NFILE and NINODE. The reason that PostgreSQL has a
+limit on the number of allowed backend processes is so your system won't
+run out of resources.
+
+
+ 3.9) What is in the /pgsql_tmp/ directory?
+
+This directory contains temporary files generated by the query executor.
+For example, if a sort needs to be done to satisfy an ORDER BY and the
+sort requires more space than the backend's /-S/ parameter allows, then
+temporary files are created here to hold the extra data.
+
+The temporary files are usually deleted automatically, but might remain
+if a backend crashes during a sort. A stop and restart of the
+/postmaster/ will remove files from those directories.
+
+
+ 3.10) Why do I need to do a dump and restore to upgrade between
+ major PostgreSQL releases?
+
+The PostgreSQL team makes only small changes between minor releases, so
+upgrading from 7.2 to 7.2.1 does not require a dump and restore.
+However, major releases (e.g. from 7.2 to 7.3) often change the internal
+format of system tables and data files. These changes are often complex,
+so we don't maintain backward compatability for data files. A dump
+outputs data in a generic format that can then be loaded in using the
+new internal format.
+
+In releases where the on-disk format does not change, the /pg_upgrade/
+script can be used to upgrade without a dump/restore. The release notes
+mention whether /pg_upgrade/ is available for the release.
+
+------------------------------------------------------------------------
+
+
+ Operational Questions
+
+
+ 4.1) What is the difference between binary cursors and normal
+ cursors?
+
+See the DECLARE manual page for a description.
+
+
+ 4.2) How do I SELECT only the first few rows of a query?
+
+See the FETCH manual page, or use SELECT ... LIMIT....
+
+The entire query may have to be evaluated, even if you only want the
+first few rows. Consider using a query that has an ORDER BY. If there is
+an index that matches the ORDER BY, PostgreSQL may be able to evaluate
+only the first few records requested, or the entire query may have to be
+evaluated until the desired rows have been generated.
+
+
+ 4.3) How do I get a list of tables or other things I can see in
+ /psql/?
+
+You can read the source code for /psql/ in file
+/pgsql/src/bin/psql/describe.c/. It contains SQL commands that generate
+the output for psql's backslash commands. You can also start /psql/ with
+the /-E/ option so it will print out the queries it uses to execute the
+commands you give.
+
+
+ 4.4) How do you remove a column from a table?
+
+This functionality was added in release 7.3 with ALTER TABLE DROP
+COLUMN. In earlier versions, you can do this:
+
+ BEGIN;
+ LOCK TABLE old_table;
+ SELECT ... -- select all columns but the one you want to remove
+ INTO TABLE new_table
+ FROM old_table;
+ DROP TABLE old_table;
+ ALTER TABLE new_table RENAME TO old_table;
+ COMMIT;
+
+
+ 4.5) What is the maximum size for a row, a table, and a database?
+
+These are the limits:
+
+ Maximum size for a database? unlimited (4 TB databases exist)
+ Maximum size for a table? 16 TB
+ Maximum size for a row? 1.6TB
+ Maximum size for a field? 1 GB
+ Maximum number of rows in a table? unlimited
+ Maximum number of columns in a table? 250-1600 depending on column types
+ Maximum number of indexes on a table? unlimited
+
+Of course, these are not actually unlimited, but limited to available
+disk space and memory/swap space. Performance may suffer when these
+values get unusually large.
+
+The maximum table size of 16 TB does not require large file support from
+the operating system. Large tables are stored as multiple 1 GB files so
+file system size limits are not important.
+
+The maximum table size and maximum number of columns can be increased if
+the default block size is increased to 32k.
+
+
+ 4.6) How much database disk space is required to store data from
+ a typical text file?
+
+A PostgreSQL database may require up to five times the disk space to
+store data from a text file.
+
+As an example, consider a file of 100,000 lines with an integer and text
+description on each line. Suppose the text string avergages twenty bytes
+in length. The flat file would be 2.8 MB. The size of the PostgreSQL
+database file containing this data can be estimated as 6.4 MB:
+
+ 36 bytes: each row header (approximate)
+ 24 bytes: one int field and one text field
+ + 4 bytes: pointer on page to tuple
+ ----------------------------------------
+ 64 bytes per row
+
+ The data page size in PostgreSQL is 8192 bytes (8 KB), so:
+
+ 8192 bytes per page
+ ------------------- = 128 rows per database page (rounded down)
+ 64 bytes per row
+
+ 100000 data rows
+ -------------------- = 782 database pages (rounded up)
+ 128 rows per page
+
+782 database pages * 8192 bytes per page = 6,406,144 bytes (6.4 MB)
+
+Indexes do not require as much overhead, but do contain the data that is
+being indexed, so they can be large also.
+
+NULLs are stored in bitmaps, so they use very little space.
+
+
+ 4.7) How do I find out what tables, indexes, databases, and
+ users are defined?
+
+/psql/ has a variety of backslash commands to show such information. Use
+\? to see them. There are also system tables beginning with /pg_/ that
+describe these too. Also, /psql -l/ will list all databases.
+
+Also try the file /pgsql/src/tutorial/syscat.source/. It illustrates
+many of the SELECTs needed to get information from the database system
+tables.
+
+
+ 4.8) My queries are slow or don't make use of the indexes. Why?
+
+Indexes are not automatically used by every query. Indexes are only used
+if the table is larger than a minimum size, and the query selects only a
+small percentage of the rows in the table. This is because the random
+disk access caused by an index scan can be slower than a straight read
+through the table, or sequential scan.
+
+To determine if an index should be used, PostgreSQL must have statistics
+about the table. These statistics are collected using VACUUM ANALYZE, or
+simply ANALYZE. Using statistics, the optimizer knows how many rows are
+in the table, and can better determine if indexes should be used.
+Statistics are also valuable in determining optimal join order and join
+methods. Statistics collection should be performed periodically as the
+contents of the table change.
+
+Indexes are normally not used for ORDER BY or to perform joins. A
+sequential scan followed by an explicit sort is usually faster than an
+index scan of a large table.
+
+However, LIMIT combined with ORDER BY often will use an index because
+only a small portion of the table is returned. In fact, though MAX() and
+MIN() don't use indexes, it is possible to retrieve such values using an
+index with ORDER BY and LIMIT:
+
+ SELECT col
+ FROM tab
+ ORDER BY col [ DESC ]
+ LIMIT 1;
+
+If you believe the optimizer is incorrect in choosing a sequential scan,
+use |SET enable_seqscan TO 'off'| and run tests to see if an index scan
+is indeed faster.
+
+When using wild-card operators such as LIKE or /~/, indexes can only be
+used in certain circumstances:
+
+ * The beginning of the search string must be anchored to the start
+ of the string, i.e.
+ o LIKE patterns must not start with /%/.
+ o /~/ (regular expression) patterns must start with /^/.
+ * The search string can not start with a character class, e.g. [a-e].
+ * Case-insensitive searches such as ILIKE and /~*/ do not utilise
+ indexes. Instead, use functional indexes, which are described in
+ section 4.12 <#4.12>.
+ * The default /C/ locale must be used during /initdb/.
+
+
+ 4.9) How do I see how the query optimizer is evaluating my query?
+
+See the EXPLAIN manual page.
+
+
+ 4.10) What is an R-tree index?
+
+An R-tree index is used for indexing spatial data. A hash index can't
+handle range searches. A B-tree index only handles range searches in a
+single dimension. R-trees can handle multi-dimensional data. For
+example, if an R-tree index can be built on an attribute of type
+/point/, the system can more efficiently answer queries such as "select
+all points within a bounding rectangle."
+
+The canonical paper that describes the original R-tree design is:
+
+Guttman, A. "R-trees: A Dynamic Index Structure for Spatial Searching."
+Proceedings of the 1984 ACM SIGMOD Int'l Conf on Mgmt of Data, 45-57.
+
+You can also find this paper in Stonebraker's "Readings in Database
+Systems".
+
+Built-in R-trees can handle polygons and boxes. In theory, R-trees can
+be extended to handle higher number of dimensions. In practice,
+extending R-trees requires a bit of work and we don't currently have any
+documentation on how to do it.
+
+
+ 4.11) What is the Genetic Query Optimizer?
+
+The GEQO module speeds query optimization when joining many tables by
+means of a Genetic Algorithm (GA). It allows the handling of large join
+queries through nonexhaustive search.
+
+
+ 4.12) How do I perform regular expression searches and
+ case-insensitive regular expression searches? How do I use an
+ index for case-insensitive searches?
+
+The /~/ operator does regular expression matching, and /~*/ does
+case-insensitive regular expression matching. The case-insensitive
+variant of LIKE is called ILIKE.
+
+Case-insensitive equality comparisons are normally expressed as:
+
+ SELECT *
+ FROM tab
+ WHERE lower(col) = 'abc';
+
+This will not use an standard index. However, if you create a functional
+index, it will be used:
+
+ CREATE INDEX tabindex ON tab (lower(col));
+
+
+ 4.13) In a query, how do I detect if a field is NULL?
+
+You test the column with IS NULL and IS NOT NULL.
+
+
+ 4.14) What is the difference between the various character types?
+
+Type Internal Name Notes
+--------------------------------------------------
+VARCHAR(n) varchar size specifies maximum length, no padding
+CHAR(n) bpchar blank padded to the specified fixed length
+TEXT text no specific upper limit on length
+BYTEA bytea variable-length byte array (null-byte safe)
+"char" char one character
+
+You will see the internal name when examining system catalogs and in
+some error messages.
+
+The first four types above are "varlena" types (i.e., the first four
+bytes on disk are the length, followed by the data). Thus the actual
+space used is slightly greater than the declared size. However, these
+data types are also subject to compression or being stored out-of-line
+by TOAST, so the space on disk might also be less than expected.
+
+VARCHAR(n) is best when storing variable-length strings and it limits
+how long a string can be. TEXT is for strings of unlimited length, with
+a maximum of one gigabyte.
+
+CHAR(n) is for storing strings that are all the same length. CHAR(n)
+pads with blanks to the specified length, while VARCHAR(n) only stores
+the characters supplied. BYTEA is for storing binary data, particularly
+values that include NULL bytes. All the types described here have
+similar performance characteristics.
+
+
+ 4.15.1) How do I create a serial/auto-incrementing field?
+
+PostgreSQL supports a SERIAL data type. It auto-creates a sequence and
+index on the column. For example, this:
+
+ CREATE TABLE person (
+ id SERIAL,
+ name TEXT
+ );
+
+is automatically translated into this:
+
+ CREATE SEQUENCE person_id_seq;
+ CREATE TABLE person (
+ id INT4 NOT NULL DEFAULT nextval('person_id_seq'),
+ name TEXT
+ );
+ CREATE UNIQUE INDEX person_id_key ON person ( id );
+
+See the /create_sequence/ manual page for more information about
+sequences. You can also use each row's /OID/ field as a unique value.
+However, if you need to dump and reload the database, you need to use
+/pg_dump/'s /-o/ option or COPY WITH OIDS option to preserve the OIDs.
+
+
+ 4.15.2) How do I get the value of a SERIAL insert?
+
+One approach is to retrieve the next SERIAL value from the sequence
+object with the /nextval()/ function /before/ inserting and then insert
+it explicitly. Using the example table in 4.15.1 <#4.15.1>, an example
+in a pseudo-language would look like this:
+
+ new_id = execute("SELECT nextval('person_id_seq')");
+ execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal')");
+
+You would then also have the new value stored in |new_id| for use in
+other queries (e.g., as a foreign key to the |person| table). Note that
+the name of the automatically created SEQUENCE object will be named
+</table/>_</serialcolumn/>_/seq/, where /table/ and /serialcolumn/ are
+the names of your table and your SERIAL column, respectively.
+
+Alternatively, you could retrieve the assigned SERIAL value with the
+/currval()/ function /after/ it was inserted by default, e.g.,
+
+ execute("INSERT INTO person (name) VALUES ('Blaise Pascal')");
+ new_id = execute("SELECT currval('person_id_seq')");
+
+Finally, you could use the OID <#4.16> returned from the INSERT
+statement to look up the default value, though this is probably the
+least portable approach. In Perl, using DBI with Edmund Mergl's DBD::Pg
+module, the oid value is made available via /$sth->{pg_oid_status}/
+after /$sth->execute()/.
+
+
+ 4.15.3) Don't /currval()/ and /nextval()/ lead to a race
+ condition with other users?
+
+No. /currval()/ returns the current value assigned by your backend, not
+by all users.
+
+
+ 4.15.4) Why aren't my sequence numbers reused on transaction
+ abort? Why are there gaps in the numbering of my sequence/SERIAL
+ column?
+
+To improve concurrency, sequence values are given out to running
+transactions as needed and are not locked until the transaction
+completes. This causes gaps in numbering from aborted transactions.
+
+
+ 4.16) What is an OID? What is a TID?
+
+OIDs are PostgreSQL's answer to unique row ids. Every row that is
+created in PostgreSQL gets a unique OID. All OIDs generated during
+/initdb/ are less than 16384 (from /include/access/transam.h/). All
+user-created OIDs are equal to or greater than this. By default, all
+these OIDs are unique not only within a table or database, but unique
+within the entire PostgreSQL installation.
+
+PostgreSQL uses OIDs in its internal system tables to link rows between
+tables. These OIDs can be used to identify specific user rows and used
+in joins. It is recommended you use column type OID to store OID values.
+You can create an index on the OID field for faster access.
+
+OIDs are assigned to all new rows from a central area that is used by
+all databases. If you want to change the OID to something else, or if
+you want to make a copy of the table, with the original OIDs, there is
+no reason you can't do it:
+
+ CREATE TABLE new_table(old_oid oid, mycol int);
+ SELECT old_oid, mycol INTO new FROM old;
+ COPY new TO '/tmp/pgtable';
+ DELETE FROM new;
+ COPY new WITH OIDS FROM '/tmp/pgtable';
+
+OIDs are stored as 4-byte integers, and will overflow at 4 billion. No
+one has reported this ever happening, and we plan to have the limit
+removed before anyone does.
+
+TIDs are used to identify specific physical rows with block and offset
+values. TIDs change after rows are modified or reloaded. They are used
+by index entries to point to physical rows.
+
+
+ 4.17) What is the meaning of some of the terms used in PostgreSQL?
+
+Some of the source code and older documentation use terms that have more
+common usage. Here are some:
+
+ * table, relation, class
+ * row, record, tuple
+ * column, field, attribute
+ * retrieve, select
+ * replace, update
+ * append, insert
+ * OID, serial value
+ * portal, cursor
+ * range variable, table name, table alias
+
+A list of general database terms can be found at:
+http://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary/glossary.html
+
+
+ 4.18) Why do I get the error /"ERROR: Memory exhausted in
+ AllocSetAlloc()"/?
+
+You probably have run out of virtual memory on your system, or your
+kernel has a low limit for certain resources. Try this before starting
+/postmaster/:
+
+ ulimit -d 262144
+ limit datasize 256m
+
+Depending on your shell, only one of these may succeed, but it will set
+your process data segment limit much higher and perhaps allow the query
+to complete. This command applies to the current process, and all
+subprocesses created after the command is run. If you are having a
+problem with the SQL client because the backend is returning too much
+data, try it before starting the client.
+
+
+ 4.19) How do I tell what PostgreSQL version I am running?
+
+From /psql/, type |SELECT version();|
+
+
+ 4.20) Why does my large-object operations get /"invalid large
+ obj descriptor"/?
+
+You need to put |BEGIN WORK| and |COMMIT| around any use of a large
+object handle, that is, surrounding |lo_open| ... |lo_close.|
+
+Currently PostgreSQL enforces the rule by closing large object handles
+at transaction commit. So the first attempt to do anything with the
+handle will draw /invalid large obj descriptor/. So code that used to
+work (at least most of the time) will now generate that error message if
+you fail to use a transaction.
+
+If you are using a client interface like ODBC you may need to set
+|auto-commit off.|
+
+
+ 4.21) How do I create a column that will default to the current
+ time?
+
+Use /CURRENT_TIMESTAMP/:
+
+|CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
+|
+
+
+ 4.22) Why are my subqueries using |IN| so slow?
+
+Currently, we join subqueries to outer queries by sequentially scanning
+the result of the subquery for each row of the outer query. If the
+subquery returns only a few rows and the outer query returns many rows,
+|IN| is fastest. To speed up other queries, replace |IN| with |EXISTS|:
+
+ SELECT *
+ FROM tab
+ WHERE col IN (SELECT subcol FROM subtab);
+
+to:
+
+ SELECT *
+ FROM tab
+ WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = col);
+
+For this to be fast, |subcol| should be an indexed column. This
+preformance problem will be fixed in 7.4.
+
+
+ 4.23) How do I perform an outer join?
+
+PostgreSQL supports outer joins using the SQL standard syntax. Here are
+two examples:
+
+ SELECT *
+ FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
+
+or
+
+ SELECT *
+ FROM t1 LEFT OUTER JOIN t2 USING (col);
+
+These identical queries join t1.col to t2.col, and also return any
+unjoined rows in t1 (those with no match in t2). A RIGHT join would add
+unjoined rows of t2. A FULL join would return the matched rows plus all
+unjoined rows from t1 and t2. The word OUTER is optional and is assumed
+in LEFT, RIGHT, and FULL joins. Ordinary joins are called INNER joins.
+
+In previous releases, outer joins can be simulated using UNION and NOT
+IN. For example, when joining /tab1/ and /tab2/, the following query
+does an /outer/ join of the two tables:
+
+ SELECT tab1.col1, tab2.col2
+ FROM tab1, tab2
+ WHERE tab1.col1 = tab2.col1
+ UNION ALL
+ SELECT tab1.col1, NULL
+ FROM tab1
+ WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
+ ORDER BY col1
+
+
+ 4.24) How do I perform queries using multiple databases?
+
+There is no way to query a database other than the current one. Because
+PostgreSQL loads database-specific system catalogs, it is uncertain how
+a cross-database query should even behave.
+
+/contrib/dblink/ allows cross-database queries using function calls. Of
+course, a client can make simultaneous connections to different
+databases and merge the results on the client side.
+
+
+ 4.25) How do I return multiple rows or columns from a function?
+
+In 7.3, you can easily return multiple rows or columns from a function,
+http://techdocs.postgresql.org/guides/SetReturningFunctions
+<http://techdocs.postgresql.org/guides/SetReturningFunctions>.
+
+
+ 4.26) Why can't I reliably create/drop temporary tables in
+ PL/PgSQL functions?
+
+PL/PgSQL caches function contents, and an unfortunate side effect is
+that if a PL/PgSQL function accesses a temporary table, and that table
+is later dropped and recreated, and the function called again, the
+function will fail because the cached function contents still point to
+the old temporary table. The solution is to use EXECUTE for temporary
+table access in PL/PgSQL. This will cause the query to be reparsed every
+time.
+
+
+ 4.27) What replication options are available?
+
+There are several master/slave replication options available. These
+allow only the master to make database changes and the slave can only do
+database reads. The bottom of
+http://gborg.PostgreSQL.org/genpage?replication_research
+<http://gborg.PostgreSQL.org/genpage?replication_research> lists them. A
+multi-master replication solution is being worked on at
+http://gborg.PostgreSQL.org/project/pgreplication/projdisplay.php.
+
+
+ 4.28) What encryption options are available?
+
+ * /contrib/pgcrypto/ contains many encryption functions for use in
+ SQL queries.
+ * The only way to encrypt transmission from the client to the server
+ is by using /hostssl/ in /pg_hba.conf/.
+ * Database user passwords are automatically encrypted when stored in
+ version 7.3. In previous versions, you must enable the option
+ /PASSWORD_ENCRYPTION/ in /postgresql.conf/.
+ * The server can run using an encrypted file system.
+
+------------------------------------------------------------------------
+
+
+ Extending PostgreSQL
+
+
+ 5.1) I wrote a user-defined function. When I run it in /psql/,
+ why does it dump core?
+
+The problem could be a number of things. Try testing your user-defined
+function in a stand-alone test program first.
+
+
+ 5.2) How can I contribute some nifty new types and functions to
+ PostgreSQL?
+
+Send your extensions to the /pgsql-hackers/ mailing list, and they will
+eventually end up in the /contrib// subdirectory.
+
+
+ 5.3) How do I write a C function to return a tuple?
+
+In versions of PostgreSQL beginning with 7.3, table-returning functions
+are fully supported in C, PL/PgSQL, and SQL. See the Programmer's Guide
+for more information. An example of a table-returning function defined
+in C can be found in /contrib/tablefunc/.
+
+
+ 5.4) I have changed a source file. Why does the recompile not
+ see the change?
+
+The /Makefiles/ do not have the proper dependencies for include files.
+You have to do a /make clean/ and then another /make/. If you are using
+GCC you can use the /--enable-depend/ option of /configure/ to have the
+compiler compute the dependencies automatically.
+
|
