woblerr commented on issue #88: URL: https://github.com/apache/cloudberry-backup/issues/88#issuecomment-4246325608
Hi According to the comment, special optimizations were performed for GP 6 https://github.com/apache/cloudberry-backup/blob/main/backup/queries_table_defs.go#L329-L332 It looks like we need to pay attention to the performance of this code. A patch solution is possible (a specific request from the issue is taken), but it should be tested on real data to confirm the perfomance improvement and correctness. ```diff SELECT a.attrelid, a.attnum, quote_ident(a.attname) AS name, a.attnotnull, a.atthasdef, pg_catalog.format_type(t.oid,a.atttypmod) AS type, coalesce(pg_catalog.array_to_string(e.attoptions, ','), '') AS encoding, a.attstattarget, CASE WHEN a.attstorage != t.typstorage THEN a.attstorage ELSE '' END AS storagetype, coalesce('('||pg_catalog.pg_get_expr(ad.adbin, ad.adrelid)||')', '') AS defaultval, coalesce(d.description, '') AS comment, a.attgenerated, - ljl_unnest AS privileges, + unnest(CASE + WHEN a.attacl IS NULL OR array_length(a.attacl, 1) IS NULL + THEN ARRAY[NULL::aclitem] + ELSE a.attacl + END) AS privileges, CASE WHEN a.attacl IS NULL THEN '' WHEN array_upper(a.attacl, 1) = 0 THEN 'Empty' ELSE '' END AS kind, coalesce(pg_catalog.array_to_string(a.attoptions, ','), '') AS options, coalesce(array_to_string(ARRAY(SELECT option_name || ' ' || quote_literal(option_value) FROM pg_options_to_table(attfdwoptions) ORDER BY option_name), ', '), '') AS fdwoptions, CASE WHEN a.attcollation <> t.typcollation THEN quote_ident(cn.nspname) || '.' || quote_ident(coll.collname) ELSE '' END AS collation, coalesce(sec.provider,'') AS securitylabelprovider, coalesce(sec.label,'') AS securitylabel, (a.attinhcount > 0) AS isinherited FROM pg_catalog.pg_attribute a JOIN pg_class c ON a.attrelid = c.oid JOIN pg_namespace n ON c.relnamespace = n.oid LEFT JOIN pg_catalog.pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum LEFT JOIN pg_catalog.pg_type t ON a.atttypid = t.oid LEFT JOIN pg_catalog.pg_attribute_encoding e ON e.attrelid = a.attrelid AND e.attnum = a.attnum LEFT JOIN pg_description d ON d.objoid = a.attrelid AND d.classoid = 'pg_class'::regclass AND d.objsubid = a.attnum LEFT JOIN pg_collation coll ON a.attcollation = coll.oid LEFT JOIN pg_namespace cn ON coll.collnamespace = cn.oid LEFT JOIN pg_seclabel sec ON sec.objoid = a.attrelid AND sec.classoid = 'pg_class'::regclass AND sec.objsubid = a.attnum - LEFT JOIN LATERAL unnest(a.attacl) ljl_unnest ON a.attacl IS NOT NULL AND array_length(a.attacl, 1) != 0 WHERE n.nspname NOT LIKE 'pg_temp_%' AND n.nspname NOT LIKE 'pg_toast%' AND n.nspname NOT IN ('gp_toolkit', 'information_schema', 'pg_aoseg', 'pg_bitmapindex', 'pg_catalog', 'pg_ext_aux') AND c.reltype <> 0 AND a.attnum > 0::pg_catalog.int2 AND a.attisdropped = 'f' ORDER BY a.attrelid, a.attnum ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
