1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Major overhaul of large-object implementation, by Denis Perchine with

kibitzing from Tom Lane.  Large objects are now all stored in a single
system relation "pg_largeobject" --- no more xinv or xinx files, no more
relkind 'l'.  This should offer substantial performance improvement for
large numbers of LOs, since there won't be directory bloat anymore.
It'll also fix problems like running out of locktable space when you
access thousands of LOs in one transaction.
Also clean up cruft in read/write routines.  LOs with "holes" in them
(never-written byte ranges) now work just like Unix files with holes do:
a hole reads as zeroes but doesn't occupy storage space.
INITDB forced!
This commit is contained in:
Tom Lane
2000-10-24 01:38:44 +00:00
parent d7186cfa9b
commit 4f44aa04b5
21 changed files with 735 additions and 1205 deletions

View File

@ -94,7 +94,7 @@ pglo_export(LODumpMaster *pgLO)
* Query
* ----------
*/
sprintf(Qbuff, "SELECT x.%s FROM %s x, pg_class c WHERE x.%s = c.oid and c.relkind = 'l'",
sprintf(Qbuff, "SELECT DISTINCT x.\"%s\" FROM \"%s\" x, pg_largeobject l WHERE x.\"%s\" = l.loid",
ll->lo_attr, ll->lo_table, ll->lo_attr);
/* puts(Qbuff); */
@ -104,7 +104,8 @@ pglo_export(LODumpMaster *pgLO)
if ((tuples = PQntuples(pgLO->res)) == 0) {
if (!pgLO->quiet && pgLO->action == ACTION_EXPORT_ATTR)
printf("%s: no large objets in '%s'\n", progname, ll->lo_table);
printf("%s: no large objects in '%s'\n",
progname, ll->lo_table);
continue;
} else if (check_res(pgLO)) {

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.5 2000/06/19 13:54:50 momjian Exp $
* $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.6 2000/10/24 01:38:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -59,10 +59,9 @@ vacuumlo(char *database, int verbose)
* First we create and populate the lo temp table
*/
buf[0] = '\0';
strcat(buf, "SELECT oid AS lo ");
strcat(buf, "SELECT DISTINCT loid AS lo ");
strcat(buf, "INTO TEMP TABLE vacuum_l ");
strcat(buf, "FROM pg_class ");
strcat(buf, "WHERE relkind='l'");
strcat(buf, "FROM pg_largeobject ");
if (!(res = PQexec(conn, buf)))
{
fprintf(stderr, "Failed to create temp table.\n");