postgres_dba icon indicating copy to clipboard operation
postgres_dba copied to clipboard

Issue of p1

Open nemfir opened this issue 6 years ago • 1 comments

Good evening, Nikolay. Thank you for tool.

Report P1 confused me. Where I'm wrong? t1 it my table originally, t2 is offered.

https://dbfiddle.uk/?rdbms=postgres_11&fiddle=cc993fad2ccc51ba6bd410612f920849 https://dbfiddle.uk/?rdbms=postgres_11&fiddle=099342ecdd74af9fd50f680e57f631bb

nemfir avatar Jan 03 '19 16:01 nemfir

Sorry for the delay with this answer @cttr-dev.

I'm looking at t1 table and the current implementation of report p1 – here is what it shows:

 Table | Table Size |     Comment      |     Wasted *     | Suggested Columns Reorder
-------+------------+------------------+------------------+---------------------------
 t1    | 8192 bytes | Includes VARLENA | ~8 bytes (0.10%) | c1, c10, c11             +
       |            |                  |                  | c12, c13, c14            +
       |            |                  |                  | c15, c16, c17            +
       |            |                  |                  | c18, c19, c2             +
       |            |                  |                  | c20, c3, c4              +
       |            |                  |                  | c5, c6, c7               +
       |            |                  |                  | c8, c9, c0               +
       |            |                  |                  | c00
(1 row)

In this situation, I wouldn't bother with column reordering -- the forecasted "waste" is <1%, so the layout is already pretty much optimized (you're using 8-byte columns first, so no alignment padding gaps in the beginning).

NikolayS avatar May 25 '20 22:05 NikolayS