PostgreSQL: Find biggest tables on your database

Posted Leave a commentPosted in PostgreSQL

Excecute the following command on phpPgAdmin on the SQL Tab.   SELECT table_name, pg_size_pretty(table_size) AS table_size, pg_size_pretty(indexes_size) AS indexes_size, pg_size_pretty(total_size) AS total_size FROM ( SELECT table_name, pg_table_size(table_name) AS table_size, pg_indexes_size(table_name) AS indexes_size, pg_total_relation_size(table_name) AS total_size FROM ( SELECT (‘”‘ || […]

PostgreSQL: Update column from another table’s column

Posted Leave a commentPosted in PostgreSQL

UPDATE c_order SET po_refernce_no = (SELECT po_refernce_no FROM “Import” WHERE c_order_id = c_order.c_order_id), tracking_number = (SELECT tracking_number FROM “Import” WHERE c_order_id = c_order.c_order_id)     UPDATE m_product SET manufacturer = (SELECT m_product_po.manufacturer FROM m_product_po WHERE m_product.m_product_id = m_product_po.m_product_id )