1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter29.Large Objects</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="client-interfaces.html" title="PartIV.Client Interfaces">
<link rel="prev" href="libpq-example.html" title="28.17.Example Programs">
<link rel="next" href="lo-implementation.html" title="29.2.Implementation Features">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" lang="en" id="largeobjects">
<div class="titlepage"><div><div><h2 class="title">
<a name="largeobjects"></a>Chapter29.Large Objects</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="sect1"><a href="largeobjects.html#lo-history">29.1. History</a></span></dt>
<dt><span class="sect1"><a href="lo-implementation.html">29.2. Implementation Features</a></span></dt>
<dt><span class="sect1"><a href="lo-interfaces.html">29.3. Client Interfaces</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="lo-interfaces.html#id688137">29.3.1. Creating a Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688296">29.3.2. Importing a Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688332">29.3.3. Exporting a Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688373">29.3.4. Opening an Existing Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688554">29.3.5. Writing Data to a Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688613">29.3.6. Reading Data from a Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688670">29.3.7. Seeking in a Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688732">29.3.8. Obtaining the Seek Position of a Large Object</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688756">29.3.9. Closing a Large Object Descriptor</a></span></dt>
<dt><span class="sect2"><a href="lo-interfaces.html#id688805">29.3.10. Removing a Large Object</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="lo-funcs.html">29.4. Server-Side Functions</a></span></dt>
<dt><span class="sect1"><a href="lo-examplesect.html">29.5. Example Program</a></span></dt>
</dl>
</div>
<a name="id687926"></a><a name="id687937"></a><p> <span class="productname">PostgreSQL</span> has a <em class="firstterm">large object</em>
facility, which provides stream-style access to user data that is stored
in a special large-object structure. Streaming access is useful
when working with data values that are too large to manipulate
conveniently as a whole.
</p>
<p> This chapter describes the implementation and the programming and
query language interfaces to <span class="productname">PostgreSQL</span>
large object data. We use the <span class="application">libpq</span> C
library for the examples in this chapter, but most programming
interfaces native to <span class="productname">PostgreSQL</span> support
equivalent functionality. Other interfaces may use the large
object interface internally to provide generic support for large
values. This is not described here.
</p>
<div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="lo-history"></a>29.1.History</h2></div></div></div>
<p> <span class="productname">POSTGRES 4.2</span>, the indirect predecessor
of <span class="productname">PostgreSQL</span>, supported three standard
implementations of large objects: as files external to the
<span class="productname">POSTGRES</span> server, as external files
managed by the <span class="productname">POSTGRES</span> server, and as
data stored within the <span class="productname">POSTGRES</span>
database. This caused considerable confusion among users. As a
result, only support for large objects as data stored within the
database is retained in <span class="productname">PostgreSQL</span>.
Even though this is slower to access, it provides stricter data
integrity. For historical reasons, this storage scheme is
referred to as <em class="firstterm">Inversion large
objects</em>. (You will see the term Inversion used
occasionally to mean the same thing as large object.) Since
<span class="productname">PostgreSQL 7.1</span>, all large objects are
placed in one system table called
<code class="classname">pg_largeobject</code>.
</p>
<p> <a name="id687736"></a>
<span class="productname">PostgreSQL</span> 7.1 introduced a mechanism
(nicknamed “<span class="quote"><acronym class="acronym">TOAST</acronym></span>”) that allows
data values to be much larger than single pages. This
makes the large object facility partially obsolete. One
remaining advantage of the large object facility is that it allows values
up to 2 GB in size, whereas <acronym class="acronym">TOAST</acronym>ed fields can be at
most 1 GB. Also, large objects can be manipulated piece-by-piece much more
easily than ordinary data fields, so the practical limits are considerably
different.
</p>
</div>
</div></body>
</html>
|