pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[SUPPORT] How to calculate size of tables which are saved on disk?
2+ messages / 2 participants
[nested] [flat]

* [SUPPORT] How to calculate size of tables which are saved on disk?
@ 2018-11-29 08:40  Nguyen Thi Nhu Thuy <ntnthuy88@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Nguyen Thi Nhu Thuy @ 2018-11-29 08:40 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: thuy-ntn@fujinet.net; vinh-th@fujinet.net; huy-ld@fujinet.net

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SUPPORT] How to calculate size of tables which are saved on disk?
@ 2018-12-05 14:33  Pavlo Golub <pavlo.golub@cybertec.at>
  parent: Nguyen Thi Nhu Thuy <ntnthuy88@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Pavlo Golub @ 2018-12-05 14:33 UTC (permalink / raw)
  To: Nguyen Thi Nhu Thuy <ntnthuy88@gmail.com>; pgsql-bugs@lists.postgresql.org; +Cc: thuy-ntn@fujinet.net; vinh-th@fujinet.net; huy-ld@fujinet.net

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-12-05 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 08:40 [SUPPORT] How to calculate size of tables which are saved on disk? Nguyen Thi Nhu Thuy <ntnthuy88@gmail.com>
2018-12-05 14:33 ` Pavlo Golub <pavlo.golub@cybertec.at>

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