Improve pg_dump's query for retrieving BLOB comments to be more efficient

when there are many blobs and not so many comments.  Tamas Vincze
This commit is contained in:
Tom Lane 2009-04-01 18:54:27 +00:00
parent 00b24e1678
commit bfd17f94b6

View File

@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.531 2009/03/26 22:26:07 petere Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.532 2009/04/01 18:54:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1995,7 +1995,13 @@ dumpBlobComments(Archive *AH, void *arg)
selectSourceSchema("pg_catalog");
/* Cursor to get all BLOB comments */
if (AH->remoteVersion >= 70200)
if (AH->remoteVersion >= 70300)
blobQry = "DECLARE blobcmt CURSOR FOR SELECT loid, "
"obj_description(loid, 'pg_largeobject') "
"FROM (SELECT DISTINCT loid FROM "
"pg_description d JOIN pg_largeobject l ON (objoid = loid) "
"WHERE classoid = 'pg_largeobject'::regclass) ss";
else if (AH->remoteVersion >= 70200)
blobQry = "DECLARE blobcmt CURSOR FOR SELECT loid, "
"obj_description(loid, 'pg_largeobject') "
"FROM (SELECT DISTINCT loid FROM pg_largeobject) ss";