[SUPPORT] How to calculate size of tables which are saved on disk?

From: Nguyen Thi Nhu Thuy <ntnthuy88(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: thuy-ntn(at)fujinet(dot)net, vinh-th(at)fujinet(dot)net, huy-ld(at)fujinet(dot)net
Subject: [SUPPORT] How to calculate size of tables which are saved on disk?
Date: 2018-11-29 08:40:00
Message-ID: CALdkpF=80Hc8QVnLx5tOtHeK_uDzR8owmXdTZhu+dTxsCueWZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello Everyone,

My name is Thuy.

This matter is not bug, but I have a question as below. May you help me?
How to calculate size of tables which are saved on disk?
Based on my internet searching, how to calculate the length of the table
based on the formula:

8KB × ceil(number of records / floor(floor(8KB × fillfactor - 24) / (28 +
data length of 1 record)))

Example:
Column | Type |
----------+---------------+
aid | integer |
bid | integer |
abalance | integer |
filler | character(84) |

data length of 1 record = aid(4 bytes) + bid(4 bytes) + abalance(4 bytes) +
filler(84 bytes + 1 byte) = 97 byte
The data length of a record must be rounded to 8 bytes.
=> Data length of 1 record is 104 bytes.

Therefore, I think that 1 character is contained in 1 byte of memory.
However, column "filler" can be input with 84 characters "a" (single byte)
or 84 characters "あ" (double-byte)

I don’t know why double-byte character can be contained in single byte
character?
Can you explain to me this question?

Thank you in advance.

--
Nguyen Thi Nhu Thuy

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jack Kelly 2018-11-29 11:14:31 Re: BUG #15525: Build failures when compiling Postgres with Make parallelization
Previous Message Thomas Munro 2018-11-29 06:25:50 Re: BUG #15525: Build failures when compiling Postgres with Make parallelization