diff options
| author | Tom Lane | 2000-10-24 01:38:44 +0000 |
|---|---|---|
| committer | Tom Lane | 2000-10-24 01:38:44 +0000 |
| commit | 4f44aa04b53f26d3abbf64beb0c1b3d10be324a3 (patch) | |
| tree | f32ad3b8c4819e87ac1fdcbe296b60880da55b56 /src/bin | |
| parent | d7186cfa9b0807deb5c4f31975a4269efa0905cf (diff) | |
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!
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_dump/pg_dump.c | 14 | ||||
| -rw-r--r-- | src/bin/pgtclsh/updateStats.tcl | 2 | ||||
| -rw-r--r-- | src/bin/psql/describe.c | 10 | ||||
| -rw-r--r-- | src/bin/psql/large_obj.c | 18 |
4 files changed, 14 insertions, 30 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index a3a914f8af3..0d2c1612805 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.174 2000/10/22 23:16:55 pjw Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.175 2000/10/24 01:38:32 tgl Exp $ * * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * @@ -1104,7 +1104,7 @@ dumpBlobs(Archive *AH, char* junkOid, void *junkVal) fprintf(stderr, "%s saving BLOBs\n", g_comment_start); /* Cursor to get all BLOB tables */ - appendPQExpBuffer(oidQry, "Declare blobOid Cursor for SELECT oid from pg_class where relkind = '%c'", RELKIND_LOBJECT); + appendPQExpBuffer(oidQry, "Declare blobOid Cursor for SELECT DISTINCT loid FROM pg_largeobject"); res = PQexec(g_conn, oidQry->data); if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) @@ -1874,8 +1874,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs) * tables before the child tables when traversing the tblinfo* * * we ignore tables that are not type 'r' (ordinary relation) or 'S' - * (sequence) or 'v' (view) --- in particular, Large Object - * relations (type 'l') are ignored. + * (sequence) or 'v' (view). */ appendPQExpBuffer(query, @@ -1886,7 +1885,6 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs) "where relname !~ '^pg_' " "and relkind in ('%c', '%c', '%c') " "order by oid", - RELKIND_VIEW, RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW); res = PQexec(g_conn, query->data); @@ -2585,7 +2583,7 @@ getIndices(int *numIndices) * find all the user-defined indices. We do not handle partial * indices. * - * Notice we skip indices on inversion objects (relkind 'l') + * Notice we skip indices on system classes * * this is a 4-way join !! */ @@ -2597,8 +2595,8 @@ getIndices(int *numIndices) "from pg_index i, pg_class t1, pg_class t2, pg_am a " "WHERE t1.oid = i.indexrelid and t2.oid = i.indrelid " "and t1.relam = a.oid and i.indexrelid > '%u'::oid " - "and t2.relname !~ '^pg_' and t2.relkind != '%c' and not i.indisprimary", - g_last_builtin_oid, RELKIND_LOBJECT); + "and t2.relname !~ '^pg_' and not i.indisprimary", + g_last_builtin_oid); res = PQexec(g_conn, query->data); if (!res || diff --git a/src/bin/pgtclsh/updateStats.tcl b/src/bin/pgtclsh/updateStats.tcl index d97c8a7b670..9cb8384dc29 100644 --- a/src/bin/pgtclsh/updateStats.tcl +++ b/src/bin/pgtclsh/updateStats.tcl @@ -59,7 +59,7 @@ proc update_attnvals {conn rel} { proc updateStats { dbName } { # datnames is the list to be result set conn [pg_connect $dbName] - set res [pg_exec $conn "SELECT relname FROM pg_class WHERE relkind = 'r' and relname !~ '^pg_' and relname !~ '^xinv'"] + set res [pg_exec $conn "SELECT relname FROM pg_class WHERE relkind = 'r' and relname !~ '^pg_'"] set ntups [pg_result $res -numTuples] for {set i 0} {$i < $ntups} {incr i} { set rel [pg_result $res -getTuple $i] diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 26c54b366a1..3db2eb95a66 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.24 2000/09/07 04:55:27 ishii Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.25 2000/10/24 01:38:38 tgl Exp $ */ #include "postgres.h" #include "describe.h" @@ -1020,10 +1020,6 @@ listTables(const char *infotype, const char *name, bool desc) strcat(buf, "'S'"); strcat(buf, ")\n"); - /* ignore large-obj indices */ - if (showIndices) - strcat(buf, " AND (c.relkind != 'i' OR c.relname !~ '^xinx')\n"); - strcat(buf, showSystem ? " AND c.relname ~ '^pg_'\n" : " AND c.relname !~ '^pg_'\n"); if (name) { @@ -1050,10 +1046,6 @@ listTables(const char *infotype, const char *name, bool desc) strcat(buf, "'S'"); strcat(buf, ")\n"); - /* ignore large-obj indices */ - if (showIndices) - strcat(buf, " AND (c.relkind != 'i' OR c.relname !~ '^xinx')\n"); - strcat(buf, showSystem ? " AND c.relname ~ '^pg_'\n" : " AND c.relname !~ '^pg_'\n"); if (name) { diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c index 020b0173eb4..5cfd18c328f 100644 --- a/src/bin/psql/large_obj.c +++ b/src/bin/psql/large_obj.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.10 2000/04/12 17:16:22 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.11 2000/10/24 01:38:39 tgl Exp $ */ #include "postgres.h" #include "large_obj.h" @@ -193,7 +193,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg) /* insert description if given */ if (comment_arg) { - sprintf(buf, "INSERT INTO pg_description VALUES (%d, '", loid); + sprintf(buf, "INSERT INTO pg_description VALUES (%u, '", loid); for (i = 0; i < strlen(comment_arg); i++) if (comment_arg[i] == '\'') strcat(buf, "\\'"); @@ -284,7 +284,7 @@ do_lo_unlink(const char *loid_arg) } /* remove the comment as well */ - sprintf(buf, "DELETE FROM pg_description WHERE objoid = %d", loid); + sprintf(buf, "DELETE FROM pg_description WHERE objoid = %u", loid); if (!(res = PSQLexec(buf))) { if (own_transaction) @@ -328,15 +328,9 @@ do_lo_list(void) printQueryOpt myopt = pset.popt; strcpy(buf, - "SELECT usename as \"Owner\", substring(relname from 5) as \"ID\",\n" - " obj_description(pg_class.oid) as \"Description\"\n" - "FROM pg_class, pg_user\n" - "WHERE usesysid = relowner AND relkind = 'l'\n" - "UNION\n" - "SELECT NULL as \"Owner\", substring(relname from 5) as \"ID\",\n" - " obj_description(pg_class.oid) as \"Description\"\n" - "FROM pg_class\n" - "WHERE not exists (select 1 from pg_user where usesysid = relowner) AND relkind = 'l'\n" + "SELECT DISTINCT loid as \"ID\",\n" + " obj_description(loid) as \"Description\"\n" + "FROM pg_largeobject\n" "ORDER BY \"ID\""); res = PSQLexec(buf); |
