Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUYFj-0006Uq-TA for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2018 14:34:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gUYFi-0002lx-KM for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2018 14:34:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUYFU-00086g-SL for pgsql-bugs@lists.postgresql.org; Wed, 05 Dec 2018 14:34:00 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUYFR-0001Pg-92 for pgsql-bugs@lists.postgresql.org; Wed, 05 Dec 2018 14:34:00 +0000 Received: from smtp1.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id A2DF249673; Wed, 5 Dec 2018 15:33:55 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id PEZF4bUPGccS; Wed, 5 Dec 2018 15:33:54 +0100 (CET) Date: Wed, 5 Dec 2018 16:33:53 +0200 From: Pavlo Golub Message-ID: <867811826.20181205163353@cybertec.at> To: Nguyen Thi Nhu Thuy , pgsql-bugs@lists.postgresql.org CC: 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: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 =C3=97 ceil(number of records / floor(floor(8KB =C3=97 fillfactor - 2= 4) / (28 + data length of 1 record))) > Example: > Column=C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0Type=C2=A0 =C2=A0 =C2=A0 | > ----------+---------------+ > =C2=A0aid=C2=A0 =C2=A0 =C2=A0 | integer=C2=A0 =C2=A0 =C2=A0 =C2=A0| > =C2=A0bid=C2=A0 =C2=A0 =C2=A0 | integer=C2=A0 =C2=A0 =C2=A0 =C2=A0| > =C2=A0abalance | integer=C2=A0 =C2=A0 =C2=A0 =C2=A0| > =C2=A0filler=C2=A0 =C2=A0| character(84) | > =C2=A0 > data length of 1 record =3D aid(4 bytes) + bid(4 bytes) + abalance(4 > bytes) + filler(84 bytes + 1 byte) =3D 97 byte > The data length of a record must be rounded to 8 bytes. =3D>> Data length of 1 record is 104 bytes. > Therefore, I think that 1 character is contained in 1 byte of memory. > However,=C2=A0 column "filler" can be input with 84 characters "a" > (single byte) or 84 characters "=E3=81=82" (double-byte) > I don=E2=80=99t know why double-byte character can be contained in single= byte character? > Can you explain to me this question? > Thank you in advance. --=20 Kind regards, Pavlo mailto:pavlo.golub@cybertec.at