AWS database single column adds extremely much data
up vote
1
down vote
favorite
I'm retrieving data from an AWS database using PgAdmin. This works well. The problem is that I have one column that I set to True after I retrieve the corresponding row, where originally it is set to Null. Doing so adds an enormous amount of data to my database.
I have checked that this is not due to other processes: it only happens when my program is running.
I am certain no rows are being added, I have checked the number of rows before and after and they're the same.
Furthermore, it only does this when changing specific tables, when I update other tables in the same database with the same process, the database size stays the same. It also does not always increase the database size, only once every couple changes does the total size increase.
How can changing a single boolean from Null to True add 0.1 MB to my database?
I'm using the following commands to check my database makeup:
To get table sizes
SELECT
relname as Table,
pg_total_relation_size(relid) As Size,
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as External Size
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
To get number of rows:
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
To get database size:
SELECT pg_database_size('mydatabasename')
amazon-web-services pgadmin
This question has an open bounty worth +150
reputation from Nathan ending ending at 2018-11-18 15:32:14Z">in 3 days.
This question has not received enough attention.
I would like to know how to fix the problem of my database increasing in size. It would also be nice to understand how come this happened.
add a comment |
up vote
1
down vote
favorite
I'm retrieving data from an AWS database using PgAdmin. This works well. The problem is that I have one column that I set to True after I retrieve the corresponding row, where originally it is set to Null. Doing so adds an enormous amount of data to my database.
I have checked that this is not due to other processes: it only happens when my program is running.
I am certain no rows are being added, I have checked the number of rows before and after and they're the same.
Furthermore, it only does this when changing specific tables, when I update other tables in the same database with the same process, the database size stays the same. It also does not always increase the database size, only once every couple changes does the total size increase.
How can changing a single boolean from Null to True add 0.1 MB to my database?
I'm using the following commands to check my database makeup:
To get table sizes
SELECT
relname as Table,
pg_total_relation_size(relid) As Size,
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as External Size
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
To get number of rows:
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
To get database size:
SELECT pg_database_size('mydatabasename')
amazon-web-services pgadmin
This question has an open bounty worth +150
reputation from Nathan ending ending at 2018-11-18 15:32:14Z">in 3 days.
This question has not received enough attention.
I would like to know how to fix the problem of my database increasing in size. It would also be nice to understand how come this happened.
Null is no data. True is a byte (8 bits). Plus one column, How many rows?
– Alexander Ingham
Nov 9 at 15:37
@AlexanderIngham I already added the column, now I'm just changing the values in the column from Null to True, one by one. It's about 20 million rows, but after retrieving 100.000 of those I already have over a GB of extra data.
– Nathan
Nov 9 at 15:41
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm retrieving data from an AWS database using PgAdmin. This works well. The problem is that I have one column that I set to True after I retrieve the corresponding row, where originally it is set to Null. Doing so adds an enormous amount of data to my database.
I have checked that this is not due to other processes: it only happens when my program is running.
I am certain no rows are being added, I have checked the number of rows before and after and they're the same.
Furthermore, it only does this when changing specific tables, when I update other tables in the same database with the same process, the database size stays the same. It also does not always increase the database size, only once every couple changes does the total size increase.
How can changing a single boolean from Null to True add 0.1 MB to my database?
I'm using the following commands to check my database makeup:
To get table sizes
SELECT
relname as Table,
pg_total_relation_size(relid) As Size,
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as External Size
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
To get number of rows:
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
To get database size:
SELECT pg_database_size('mydatabasename')
amazon-web-services pgadmin
I'm retrieving data from an AWS database using PgAdmin. This works well. The problem is that I have one column that I set to True after I retrieve the corresponding row, where originally it is set to Null. Doing so adds an enormous amount of data to my database.
I have checked that this is not due to other processes: it only happens when my program is running.
I am certain no rows are being added, I have checked the number of rows before and after and they're the same.
Furthermore, it only does this when changing specific tables, when I update other tables in the same database with the same process, the database size stays the same. It also does not always increase the database size, only once every couple changes does the total size increase.
How can changing a single boolean from Null to True add 0.1 MB to my database?
I'm using the following commands to check my database makeup:
To get table sizes
SELECT
relname as Table,
pg_total_relation_size(relid) As Size,
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as External Size
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
To get number of rows:
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
To get database size:
SELECT pg_database_size('mydatabasename')
amazon-web-services pgadmin
amazon-web-services pgadmin
edited Nov 11 at 16:48
asked Nov 9 at 15:26
Nathan
1,115517
1,115517
This question has an open bounty worth +150
reputation from Nathan ending ending at 2018-11-18 15:32:14Z">in 3 days.
This question has not received enough attention.
I would like to know how to fix the problem of my database increasing in size. It would also be nice to understand how come this happened.
This question has an open bounty worth +150
reputation from Nathan ending ending at 2018-11-18 15:32:14Z">in 3 days.
This question has not received enough attention.
I would like to know how to fix the problem of my database increasing in size. It would also be nice to understand how come this happened.
Null is no data. True is a byte (8 bits). Plus one column, How many rows?
– Alexander Ingham
Nov 9 at 15:37
@AlexanderIngham I already added the column, now I'm just changing the values in the column from Null to True, one by one. It's about 20 million rows, but after retrieving 100.000 of those I already have over a GB of extra data.
– Nathan
Nov 9 at 15:41
add a comment |
Null is no data. True is a byte (8 bits). Plus one column, How many rows?
– Alexander Ingham
Nov 9 at 15:37
@AlexanderIngham I already added the column, now I'm just changing the values in the column from Null to True, one by one. It's about 20 million rows, but after retrieving 100.000 of those I already have over a GB of extra data.
– Nathan
Nov 9 at 15:41
Null is no data. True is a byte (8 bits). Plus one column, How many rows?
– Alexander Ingham
Nov 9 at 15:37
Null is no data. True is a byte (8 bits). Plus one column, How many rows?
– Alexander Ingham
Nov 9 at 15:37
@AlexanderIngham I already added the column, now I'm just changing the values in the column from Null to True, one by one. It's about 20 million rows, but after retrieving 100.000 of those I already have over a GB of extra data.
– Nathan
Nov 9 at 15:41
@AlexanderIngham I already added the column, now I'm just changing the values in the column from Null to True, one by one. It's about 20 million rows, but after retrieving 100.000 of those I already have over a GB of extra data.
– Nathan
Nov 9 at 15:41
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
What do you mean adds data? to all the data files? specifically to some files?
to get a precise answer you should supply more details, but generally speaking, any DB operation will add data to the transaction logs, and possibly other files.
Hi Ophir, what I mean is that the total database size increases. Strangely enough this only happens when I change specific tables. I understand it always adds some data, but it currently adds such an exorbitant amount of space that something has to be wrong.
– Nathan
Nov 11 at 16:43
add a comment |
up vote
0
down vote
The problem is that As described here
"In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table"
Furthermore, we did not always close the cursor which also increased database size while running.
The current solution is to do a full vacuum every once in a while.
The problem still persists less strongly
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
What do you mean adds data? to all the data files? specifically to some files?
to get a precise answer you should supply more details, but generally speaking, any DB operation will add data to the transaction logs, and possibly other files.
Hi Ophir, what I mean is that the total database size increases. Strangely enough this only happens when I change specific tables. I understand it always adds some data, but it currently adds such an exorbitant amount of space that something has to be wrong.
– Nathan
Nov 11 at 16:43
add a comment |
up vote
0
down vote
What do you mean adds data? to all the data files? specifically to some files?
to get a precise answer you should supply more details, but generally speaking, any DB operation will add data to the transaction logs, and possibly other files.
Hi Ophir, what I mean is that the total database size increases. Strangely enough this only happens when I change specific tables. I understand it always adds some data, but it currently adds such an exorbitant amount of space that something has to be wrong.
– Nathan
Nov 11 at 16:43
add a comment |
up vote
0
down vote
up vote
0
down vote
What do you mean adds data? to all the data files? specifically to some files?
to get a precise answer you should supply more details, but generally speaking, any DB operation will add data to the transaction logs, and possibly other files.
What do you mean adds data? to all the data files? specifically to some files?
to get a precise answer you should supply more details, but generally speaking, any DB operation will add data to the transaction logs, and possibly other files.
answered Nov 11 at 15:48
Ophir Yoktan
4,26122970
4,26122970
Hi Ophir, what I mean is that the total database size increases. Strangely enough this only happens when I change specific tables. I understand it always adds some data, but it currently adds such an exorbitant amount of space that something has to be wrong.
– Nathan
Nov 11 at 16:43
add a comment |
Hi Ophir, what I mean is that the total database size increases. Strangely enough this only happens when I change specific tables. I understand it always adds some data, but it currently adds such an exorbitant amount of space that something has to be wrong.
– Nathan
Nov 11 at 16:43
Hi Ophir, what I mean is that the total database size increases. Strangely enough this only happens when I change specific tables. I understand it always adds some data, but it currently adds such an exorbitant amount of space that something has to be wrong.
– Nathan
Nov 11 at 16:43
Hi Ophir, what I mean is that the total database size increases. Strangely enough this only happens when I change specific tables. I understand it always adds some data, but it currently adds such an exorbitant amount of space that something has to be wrong.
– Nathan
Nov 11 at 16:43
add a comment |
up vote
0
down vote
The problem is that As described here
"In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table"
Furthermore, we did not always close the cursor which also increased database size while running.
The current solution is to do a full vacuum every once in a while.
The problem still persists less strongly
add a comment |
up vote
0
down vote
The problem is that As described here
"In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table"
Furthermore, we did not always close the cursor which also increased database size while running.
The current solution is to do a full vacuum every once in a while.
The problem still persists less strongly
add a comment |
up vote
0
down vote
up vote
0
down vote
The problem is that As described here
"In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table"
Furthermore, we did not always close the cursor which also increased database size while running.
The current solution is to do a full vacuum every once in a while.
The problem still persists less strongly
The problem is that As described here
"In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table"
Furthermore, we did not always close the cursor which also increased database size while running.
The current solution is to do a full vacuum every once in a while.
The problem still persists less strongly
edited 6 hours ago
answered 13 hours ago
Nathan
1,115517
1,115517
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228612%2faws-database-single-column-adds-extremely-much-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Null is no data. True is a byte (8 bits). Plus one column, How many rows?
– Alexander Ingham
Nov 9 at 15:37
@AlexanderIngham I already added the column, now I'm just changing the values in the column from Null to True, one by one. It's about 20 million rows, but after retrieving 100.000 of those I already have over a GB of extra data.
– Nathan
Nov 9 at 15:41