pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavlo Golub <pavlo.golub@cybertec.at>
To: Nguyen Thi Nhu Thuy <ntnthuy88@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Cc: thuy-ntn@fujinet.net
Cc: vinh-th@fujinet.net
Cc: huy-ld@fujinet.net
Subject: Re: [SUPPORT] How to calculate size of tables which are saved on disk?
Date: Wed, 5 Dec 2018 16:33:53 +0200
Message-ID: <867811826.20181205163353@cybertec.at> (raw)
In-Reply-To: <CALdkpF=80Hc8QVnLx5tOtHeK_uDzR8owmXdTZhu+dTxsCueWZA@mail.gmail.com>
References: <CALdkpF=80Hc8QVnLx5tOtHeK_uDzR8owmXdTZhu+dTxsCueWZA@mail.gmail.com>

Greetings, Nguyen.

Have you checked https://wiki.postgresql.org/wiki/Disk_Usage ?

You wrote 29.11.2018, 10:40:

> 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.




-- 
Kind regards,
 Pavlo                          mailto:pavlo.golub@cybertec.at





view thread (2+ messages)

Message-ID: <867811826.20181205163353@cybertec.at>
Permalink:  ../867811826.20181205163353@cybertec.at/
Also on:    postgresql.org/message-id/867811826.20181205163353@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pavlo.golub@cybertec.at, ntnthuy88@gmail.com, thuy-ntn@fujinet.net, vinh-th@fujinet.net, huy-ld@fujinet.net
  Subject: Re: [SUPPORT] How to calculate size of tables which are saved on disk?
  In-Reply-To: <867811826.20181205163353@cybertec.at>
  References: <CALdkpF=80Hc8QVnLx5tOtHeK_uDzR8owmXdTZhu+dTxsCueWZA@mail.gmail.com> <867811826.20181205163353@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox