Project

General

Profile

Actions

Bug #14004

closed

Wasted disk space due to inefficient columns ordering

Added by Nicolas CHARLES over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Priority:
N/A
Category:
Performance and scalability
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Fix check:
Regression:

Description

According to https://blog.2ndquadrant.com/on-rocks-and-sand/ proper column ordering in Postgresql can save up to 10-20% of disk space
Given that Rudder uses quite a lot of free space, it would be relevant to benefit from this

Note that Postresql is so wonderful that it advertise which ordering is the best for a table:

rudder=> SELECT a.attname, t.typname, t.typalign, t.typlen
rudder->   FROM pg_class c
rudder->   JOIN pg_attribute a ON (a.attrelid = c.oid)
rudder->   JOIN pg_type t ON (t.oid = a.atttypid)
rudder->  WHERE c.relname = 'nodecompliancelevels'   AND a.attnum >= 0
rudder->  ORDER BY t.typlen DESC;
      attname       |   typname   | typalign | typlen 
--------------------+-------------+----------+--------
 runtimestamp       | timestamptz | d        |      8
 badpolicymode      | int4        | i        |      4
 auditnotapplicable | int4        | i        |      4
 noncompliant       | int4        | i        |      4
 auditerror         | int4        | i        |      4
 pending            | int4        | i        |      4
 success            | int4        | i        |      4
 repaired           | int4        | i        |      4
 error              | int4        | i        |      4
 unexpected         | int4        | i        |      4
 missing            | int4        | i        |      4
 noanswer           | int4        | i        |      4
 notapplicable      | int4        | i        |      4
 reportsdisabled    | int4        | i        |      4
 compliant          | int4        | i        |      4
 ruleid             | text        | i        |     -1
 directiveid        | text        | i        |     -1
 nodeid             | text        | i        |     -1
(18 lignes)

this ticket will only update table creation and migration - we won't change existing tables

Actions

Also available in: Atom PDF