Search Postgresql Archives

long transactions / backend memory usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

We have run into a case where we run a long transaction, and during the transaction the backend process's memory usage is growing constantly.

I've written a script to simulate this, please someone confirm if it is normal or not.

The script just inserts and removes rows in a table in a single transaction. If given a parameter, the same row is being inserted and removed.

The latter case also produces constantly increasing backend process memory usage.

Create the table as in the script, and after run:

$ perl pqtest.pl 5

I've been running the script for nearly 40 minutes right now, it has done 120k iterations, and the RSS of the postgresql process is still growing.

This can be reproduced on 9.3 and 9.4 also.

Thanks in advance,
Kojedzinszky Richárd
Euronet Magyarorszag Informatika Zrt.
#!/usr/bin/perl

use common::sense;
use DBI;

# create the table:
#
# create table a (id int primary key, v1 int, v2 int, v3 int);
#

sub main {
	my (@argv) = @_;

	my $id = 0;
	my $increment = 1;
	my $total = 0;

	my $dbh = DBI->connect("DBI:Pg:dbname=test");
	$dbh->begin_work();

	my $ins = $dbh->prepare("INSERT INTO a (id, v1, v2, v3) VALUES (?, ?, ?, ?)");
	my $del = $dbh->prepare("DELETE FROM a WHERE id = ?");

	if (@argv) {
		$id = $argv[0];
		$increment = 0;
	}

	for (;;$id += $increment) {
		$ins->execute($id, $id, $id, $id);
		$del->execute($id);

		print STDERR "#$total: $id\r";
		++$total;
	}
}

exit(main(@ARGV));
-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux