Created
June 18, 2021 00:09
-
-
Save anand086/bdb109d5347e19a627b4ecf56ea2d476 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE article ( | |
id SERIAL UNIQUE NOT NULL, | |
code VARCHAR(10) NOT NULL, | |
article TEXT, | |
name TEXT NOT NULL, | |
department VARCHAR(4) | |
); | |
insert into article ( | |
code, article, name, department | |
) | |
select | |
left(md5(i::text), 10), | |
md5(random()::text), | |
md5(random()::text), | |
left(md5(random()::text), 4) | |
from generate_series(1, 1000000) s(i) | |
admin@fleetdb # \d article | |
Table "admin.article" | |
+------------+-----------------------+-----------+----------+-------------------------------------+ | |
| Column | Type | Collation | Nullable | Default | | |
+------------+-----------------------+-----------+----------+-------------------------------------+ | |
| id | integer | | not null | nextval('article_id_seq'::regclass) | | |
| code | character varying(10) | | not null | | | |
| article | text | | | | | |
| name | text | | not null | | | |
| department | character varying(4) | | | | | |
+------------+-----------------------+-----------+----------+-------------------------------------+ | |
Indexes: | |
"article_id_key" UNIQUE CONSTRAINT, btree (id) | |
admin@fleetdb # \i table_size.sql | |
Enter the relation name:article | |
+-------+--------------+------------+----------------+--------------+-------------+-------------+--------------+--------+-------+------------+--------+ | |
| oid | table_schema | table_name | row_estimate | total_bytes | index_bytes | toast_bytes | table_bytes | total | index | toast | table | | |
+-------+--------------+------------+----------------+--------------+-------------+-------------+--------------+--------+-------+------------+--------+ | |
| 74288 | admin | article | 1.00000006e+09 | 139518713856 | 22461349888 | 8192 | 117057355776 | 130 GB | 21 GB | 8192 bytes | 109 GB | | |
+-------+--------------+------------+----------------+--------------+-------------+-------------+--------------+--------+-------+------------+--------+ | |
(1 row) | |
admin@fleetdb # select * from article limit 5; | |
+---------+------------+----------------------------------+----------------------------------+------------+ | |
| id | code | article | name | department | | |
+---------+------------+----------------------------------+----------------------------------+------------+ | |
| 1078401 | ad5cd87412 | c213ddd48db9e5c0d2386bc0fedd59cf | 9b331bc79d967cc4403c56d7e51f275a | 7c5d | | |
| 1078402 | 5adfc37e8b | 0ffb8cdb521fafe16a4caed63b13f2d3 | 8cf51fc7ce7d316dce6da10947c4a538 | 7517 | | |
| 1078403 | 8e1302db3b | bbf7c48351fb478559082c087119d318 | 33c525bca96e89d11bb041f43f5af1e4 | b66e | | |
| 1078404 | 2588231ba5 | 1592cd3e92b2cf54b159b03f35e35303 | 7bb4db38f74a78ef0ac196fa088fdaf8 | 7657 | | |
| 1078405 | 47fa1ae0d5 | e2a0e8c29749765f6e01593f7b87735c | 1d58ee700b8bef4b681cf3aa8980445e | f435 | | |
+---------+------------+----------------------------------+----------------------------------+------------+ | |
(5 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment