Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

DROP FUNCTION script with the type of Parameters

In this post, I am sharing a script to measure the size of a PostgreSQL Table Row.

I taken reference from this dba.statckexchange.

But again, I would like to share this information with some additional information.

Fillfactor storage parameter of PostgreSQL Table.

Before changing the default value of Fillfactor, we should measure the size of Table Row.

For knowing the row size is very important because if table row size is larger, we should not change the default value of Fillfactor.

When we are doing performance optimization, this is very important to find the size of the Data page and Table row, otherwise unnecessary we are dealing with high fragmentation and executing VACUUM FULL or VACUUM again and again.

If your total row size is under 8kb, you can take decision to alter table storage parameters.

In the PostgreSQL, If you want to drop a function, you also have to mention the type of the parameters.

In this post, I am providing a script which populates DROP FUNCTION script with all the type of parameters.

For example:

One function definition is:
CREATE FUNCTION fn_test (id integer, name character varying);
You cannot drop this function using just DROP FUNCTION like:
DROP FUNCTION fn_test();
You have to also specify the type of the parameters like:
DROP FUNCTION fn_test(integer, character varying);
If we are going to drop multiple functions, we need a script for dropping all functions by specifying their relevant type of parameters.

Below is a script to solve this problem and using it you can get a full DROP FUNCTION script with the type of input parameters. You can select the require drop function script and execute it.
SELECT FORMAT('DROP FUNCTION %s(%s);'
             ,p.oid::regproc
             ,pg_get_function_identity_arguments(p.oid))
FROM pg_proc AS p 
INNER JOIN pg_namespace AS n 
 ON p.pronamespace = n.oid 
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema');


Comments

Popular posts from this blog

PostgreSQL Pgbadger Installation On Linux

PostgreSQL Sequence

Postgresql maximum size

How to configure Replication Manager (repmgr) ?

PostgreSQL pgBadger