Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C16FB9FB609 for ; Thu, 5 Jul 2007 09:39:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 95252-04 for ; Thu, 5 Jul 2007 09:39:04 -0300 (ADT) X-Greylist: delayed 00:23:10.973155 by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 292DC9FB2E7 for ; Thu, 5 Jul 2007 09:39:03 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from pat.uio.no (pat.uio.no [129.240.10.15]) by svr4.postgresql.org (Postfix) with ESMTP id 01BF15AF88F for ; Thu, 5 Jul 2007 12:15:51 +0000 (GMT) Received: from mail-mx9.uio.no ([129.240.10.39]) by pat.uio.no with esmtp (Exim 4.67) (envelope-from ) id 1I6QFR-0001YE-KZ for pgsql-performance@postgresql.org; Thu, 05 Jul 2007 14:15:49 +0200 Received: from smtp.uio.no ([129.240.10.9] helo=mail-mx9.uio.no) by mail-mx9.uio.no with esmtp (Exim 4.67) (envelope-from ) id 1I6QFR-0004sx-3I for pgsql-performance@postgresql.org; Thu, 05 Jul 2007 14:15:49 +0200 Received: from mail-web3.uio.no ([129.240.10.20] helo=webmail.uio.no) by mail-mx9.uio.no with esmtp (Exim 4.67) (envelope-from ) id 1I6QFQ-0004ss-Ud for pgsql-performance@postgresql.org; Thu, 05 Jul 2007 14:15:48 +0200 Received: from 134.32.140.234 (SquirrelMail authenticated user tfinneid) by webmail.uio.no with HTTP; Thu, 5 Jul 2007 14:15:48 +0200 (CEST) Message-ID: <40362.134.32.140.234.1183637748.squirrel@webmail.uio.no> Date: Thu, 5 Jul 2007 14:15:48 +0200 (CEST) Subject: improvement suggestions for performance design From: tfinneid@ifi.uio.no To: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.10a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-UiO-Resend: resent X-UiO-Spam-info: not spam, SpamAssassin (score=-4.8, required=12.0, autolearn=disabled, AWL=0.224, UIO_MAIL_IS_INTERNAL=-5) X-UiO-Scanned: 78E420C0E3070A414FA9C1698C4E0D213061D227 X-UiO-SPAM-Test: remote_host: 129.240.10.9 spam_score: -47 maxlevel 200 minaction 2 bait 0 mail/h: 350 total 2727412 max/h 8345 blacklist 0 greylist 0 ratelimit 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.097 tagged_above=0 required=5 tests=BAYES_50=0.001, FORGED_RCVD_HELO=0.135, NO_REAL_NAME=0.961 X-Spam-Level: * X-Archive-Number: 200707/31 X-Sequence-Number: 25715 Hi I have the following scenario for a database that I need to design, and would like some hints on what to improve or do differently to achieve the desired performance goal, disregarding hardware and postgres tuning. The premise is an attribute database that stores about 100 different attribute types as attribute values. Every X seconds, Y number of new attribute values are stored in the database. X is constant and currently between 6 and 20 seconds, depending on the setup. In the future X could become as low as 3 seconds. Y can, within the next 5-10 years, become as high as 200 000. That means that for example, every 6 seconds 100 000 attributes needs to be written to the database. At the same time, somewhere between 5-20 users needs to read parts of those newly written attributes, maybe in total 30 000 attributes. This continues for the duration of the field operation, which could be 18hrs a day for 6 weeks. So the total db size is up towards 200 gigs. Now here is how I suggest doing this: 1- the tables table attribute_values: id int attr_type int ( references attribute_types(id) ) posX int posY int data_type int value varchar(50) table attribute_types: id int name varchar(200); 2- function a function that receives an array of data and inserts each attribute. perhaps one array per attribute data (type, posX, posY, data_type, value) so five arrays as in parameters ot the function 3- java client the client receives the data from a corba request, and splits it into, say 4 equally sized blocks and executes 4 threads that insert each block (this seems to be more efficient than just using one thread.) Now I am wondering if this is the most efficient way of doing it? - I know that I could group the attributes so that each type of attribute gets its own table with all attributes in one row. But I am not sure if that is any more efficient than ont attribute per row since I pass everything to the function as an array. With the above design a change in attribute types only requires changing the data in a table instead of having to modify the client, the function and the tables. - I am also wondering if writing the client and function in C would create a more efficient solution. any comments? ps, I am currently running postgres 8.1, but could probably use 8.2 if it is needed for functionality or performance reasons. It will run on a sparc machine with solaris 10 and perhaps 4-6 processors, as many GB of RAM as necessary and SCSI disks ( perhaps in raid 0 ). regards thomas