X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3792FD1B4F4 for ; Wed, 5 Nov 2003 18:28:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 93698-03 for ; Wed, 5 Nov 2003 14:27:52 -0400 (AST) Received: from mail.tpi.pl (mail.tpi.pl [193.110.121.18]) by svr1.postgresql.org (Postfix) with ESMTP id 0215BD1BB60 for ; Wed, 5 Nov 2003 14:27:36 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.tpi.pl (Postfix) with ESMTP id B3D3046E95; Wed, 5 Nov 2003 19:27:34 +0100 (CET) Received: from mail.tpi.pl ([127.0.0.1]) by localhost (silver [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28793-13; Wed, 5 Nov 2003 19:27:34 +0100 (CET) Received: from [10.5.3.38] (lan-out [193.110.121.17]) by mail.tpi.pl (Postfix) with ESMTP id A1F0446E75; Wed, 5 Nov 2003 19:27:28 +0100 (CET) Subject: Re: performance problem - 10.000 databases From: Marek Florianczyk To: Tom Lane Cc: pgsql-admin@postgresql.org In-Reply-To: <3453.1068055189@sss.pgh.pa.us> References: <1067594647.22286.57.camel@franki-laptop.tpi.pl> <9643.1067610219@sss.pgh.pa.us> <1068039213.28814.116.camel@franki-laptop.tpi.pl> <3453.1068055189@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-2 Organization: Message-Id: <1068056378.28827.172.camel@franki-laptop.tpi.pl> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 05 Nov 2003 19:19:39 +0100 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at TP Internet X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/70 X-Sequence-Number: 11058 W li¶cie z ¶ro, 05-11-2003, godz. 18:59, Tom Lane pisze: > Marek Florianczyk writes: > > Each client was doing: > > > 10 x connect,"select * from table[rand(1-4)] where > > number=[rand(1-1000)]",disconnect--(fetch one row) > > Seems like this is testing the cost of connect and disconnect to the > exclusion of nearly all else. PG is not designed to process just one > query per connection --- backend startup is too expensive for that. > Consider using a connection-pooling module if your application wants > short-lived connections. You right, maybe typical php page will have more queries "per view" How good is connection-pooling module when connection from each virtual site is uniq? Different user and password, and differen schemas and permissions, so this connect-pooling module would have to switch between users, without reconnecting to database? Impossible ? > > > I noticed that queries like: "\d table1" "\di" "\dp" are extremly slow, > > I thought maybe you'd uncovered a performance issue with lots of > schemas, but I can't reproduce it here. I made 10000 schemas each > containing a table "mytab", which is about the worst case for an > unqualified "\d mytab", but it doesn't seem excessively slow --- maybe > about a quarter second to return the one mytab that's actually in my > search path. In realistic conditions where the users aren't all using > the exact same table names, I don't think there's an issue. But did you do that under some database load ? eg. 100 clients connected, like in my example ? When I do these queries "\d" without any clients connected and after ANALYZE it's fast, but only 100 clients is enough to lengthen query time to 30 sec. :( I've 3000 schemas named: test[1-3000] and 3000 users named test[1-3000] in each schema there is four tables (table1 table2 table3 table4 ) each table has 3 column (int,text,int) and some of them has also indexes. If you want, I will send perl script that forks to 100 process and perform my queries. greetings Marek > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html >