|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.39 2006/03/10 19:10:48 momjian Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.40 2006/04/23 03:39:52 momjian Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="largeObjects">
|
4 | 4 | <title id="largeObjects-title">Large Objects</title>
|
|
25 | 25 | values. This is not described here.
|
26 | 26 | </para>
|
27 | 27 |
|
28 |
| - <sect1 id="lo-history"> |
29 |
| - <title>History</title> |
| 28 | + <sect1 id="lo-intro"> |
| 29 | + <title>Introduction</title> |
30 | 30 |
|
31 |
| - <para> |
32 |
| - <productname>POSTGRES 4.2</productname>, the indirect predecessor |
33 |
| - of <productname>PostgreSQL</productname>, supported three standard |
34 |
| - implementations of large objects: as files external to the |
35 |
| - <productname>POSTGRES</productname> server, as external files |
36 |
| - managed by the <productname>POSTGRES</productname> server, and as |
37 |
| - data stored within the <productname>POSTGRES</productname> |
38 |
| - database. This caused considerable confusion among users. As a |
39 |
| - result, only support for large objects as data stored within the |
40 |
| - database is retained in <productname>PostgreSQL</productname>. |
41 |
| - Even though this is slower to access, it provides stricter data |
42 |
| - integrity. For historical reasons, this storage scheme is |
43 |
| - referred to as <firstterm>Inversion large |
44 |
| - objects</firstterm>. (You will see the term Inversion used |
45 |
| - occasionally to mean the same thing as large object.) Since |
46 |
| - <productname>PostgreSQL 7.1</productname>, all large objects are |
47 |
| - placed in one system table called |
48 |
| - <classname>pg_largeobject</classname>. |
49 |
| - </para> |
| 31 | + <indexterm> |
| 32 | + <primary>TOAST</primary> |
| 33 | + <secondary>versus large objects</secondary> |
| 34 | + </indexterm> |
50 | 35 |
|
51 | 36 | <para>
|
52 |
| - <indexterm> |
53 |
| - <primary>TOAST</primary> |
54 |
| - <secondary>versus large objects</secondary> |
55 |
| - </indexterm> |
56 |
| - <productname>PostgreSQL</productname> 7.1 introduced a mechanism |
57 |
| - (nicknamed <quote><acronym>TOAST</acronym></quote>) that allows |
58 |
| - data values to be much larger than single pages. This |
59 |
| - makes the large object facility partially obsolete. One |
| 37 | + All large objects are placed in a single system table called |
| 38 | + <classname>pg_largeobject</classname>. |
| 39 | + <productname>PostgreSQL</productname> also supports a storage system called |
| 40 | + <quote><acronym>TOAST</acronym></quote> that automatically stores values |
| 41 | + larger than a single database page into a secondary storage area per table. |
| 42 | + This makes the large object facility partially obsolete. One |
60 | 43 | remaining advantage of the large object facility is that it allows values
|
61 | 44 | up to 2 GB in size, whereas <acronym>TOAST</acronym>ed fields can be at
|
62 |
| - most 1 GB. Also, large objects can bemanipulated piece-by-piece much more |
63 |
| -easily than ordinary data fields, so the practical limits are considerably |
64 |
| -different. |
| 45 | + most 1 GB. Also, large objects can berandomly modified using a read/write |
| 46 | +API that is more efficient than performing such operations using |
| 47 | +<acronym>TOAST</acronym>. |
65 | 48 | </para>
|
66 | 49 |
|
67 | 50 | </sect1>
|
|
70 | 53 | <title>Implementation Features</title>
|
71 | 54 |
|
72 | 55 | <para>
|
73 |
| - The large object implementation breakslarge |
74 |
| - objectsupinto<quote>chunks</quote>andstores the chunks in |
| 56 | + The large object implementation breaks large |
| 57 | + objects up into <quote>chunks</quote> and stores the chunks in |
75 | 58 | rows in the database. A B-tree index guarantees fast
|
76 | 59 | searches for the correct chunk number when doing random
|
77 | 60 | access reads and writes.
|
|
86 | 69 | <productname>PostgreSQL</productname> client interface libraries
|
87 | 70 | provide for accessing large objects. All large object
|
88 | 71 | manipulation using these functions <emphasis>must</emphasis> take
|
89 |
| - place within an SQL transaction block. (This requirement is |
90 |
| - strictly enforced as of <productname>PostgreSQL 6.5</>, though it |
91 |
| - has been an implicit requirement in previous versions, resulting |
92 |
| - in misbehavior if ignored.) |
| 72 | + place within an SQL transaction block. |
93 | 73 | The <productname>PostgreSQL</productname> large object interface is modeled after
|
94 | 74 | the <acronym>Unix</acronym> file-system interface, with analogues of
|
95 | 75 | <function>open</function>, <function>read</function>,
|
|