From 4f44aa04b53f26d3abbf64beb0c1b3d10be324a3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 24 Oct 2000 01:38:44 +0000 Subject: 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! --- contrib/pg_dumplo/lo_export.c | 5 +++-- contrib/vacuumlo/vacuumlo.c | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'contrib') diff --git a/contrib/pg_dumplo/lo_export.c b/contrib/pg_dumplo/lo_export.c index e18c3ef651..248cf831f5 100644 --- a/contrib/pg_dumplo/lo_export.c +++ b/contrib/pg_dumplo/lo_export.c @@ -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)) { diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index 3f2c592c09..6e46caf8dd 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -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"); -- cgit v1.2.1