From pgsql-general-owner@postgresql.org Tue Oct 1 14:28:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AA8F7475FBD; Tue, 1 Oct 2002 14:27:59 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 3DD86475FBA; Tue, 1 Oct 2002 14:27:59 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 50AF9D60C; Tue, 1 Oct 2002 11:27:56 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 465585C05; Tue, 1 Oct 2002 11:27:56 -0700 (PDT) Date: Tue, 1 Oct 2002 11:27:56 -0700 (PDT) From: Stephan Szabo To: Adam Siegel Cc: , Subject: Re: [pgsql-performance] Deletes from tables with foreign keys taking In-Reply-To: <00ca01c26978$490ee4a0$1537140a@orbital.com> Message-ID: <20021001112632.F96255-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/33 X-Sequence-Number: 31032 On Tue, 1 Oct 2002, Adam Siegel wrote: > I have a table that has about 200 rows in it. I have 2 other tables > that have about 300,000 rows each that reference the first table > through a foriegn key. I run a process that rebuilds these tables. > First I delete the rows in the large tables (takes about 30 seconds), > then I delete the the rows in the first table (takes about 5 minutes > !!!). Each of these are done in separate transactions. > > If I do a vacuum analyze on each of the large tables just after the > delete then deleting the rows from the first table takes just a second > or two. My guess is that postgres is still check the foriegn keys > from the first table to the others even though the records are deleted > in the larger tables. The vacuum cleans up the deleted records, so it > goes faster. Am I wrong. Any ideas? That seems reasonable. It's still going to be doing some action on those tables and it's going to have to scan the tables in some case. It's wierd that it's taking that long to do it in any case however, what does the schema for the tables look like? From pgsql-general-owner@postgresql.org Tue Oct 1 14:23:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4C330476789; Tue, 1 Oct 2002 14:23:51 -0400 (EDT) Received: from sauron.saihost.net (www.saihost.net [204.178.107.105]) by postgresql.org (Postfix) with ESMTP id 8573D4761EA; Tue, 1 Oct 2002 14:23:50 -0400 (EDT) Received: from c2002322 (computrain-client-sycamore.2gaap.net [63.89.77.233] (may be forged)) (authenticated) by sauron.saihost.net (8.11.6/8.11.6) with ESMTP id g91INo116339; Tue, 1 Oct 2002 14:23:50 -0400 Message-ID: <00ca01c26978$490ee4a0$1537140a@orbital.com> From: "Adam Siegel" To: , Subject: Deletes from tables with foreign keys taking too long Date: Tue, 1 Oct 2002 14:28:04 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00C7_01C26956.C11136F0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/32 X-Sequence-Number: 31031 This is a multi-part message in MIME format. ------=_NextPart_000_00C7_01C26956.C11136F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a table that has about 200 rows in it. I have 2 other tables that h= ave about 300,000 rows each that reference the first table through a forieg= n key. I run a process that rebuilds these tables. First I delete the row= s in the large tables (takes about 30 seconds), then I delete the the rows = in the first table (takes about 5 minutes !!!). Each of these are done in = separate transactions. If I do a vacuum analyze on each of the large tables just after the delete = then deleting the rows from the first table takes just a second or two. My= guess is that postgres is still check the foriegn keys from the first tabl= e to the others even though the records are deleted in the larger tables. = The vacuum cleans up the deleted records, so it goes faster. Am I wrong. = Any ideas? Regards, Adam ------=_NextPart_000_00C7_01C26956.C11136F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have a table that has about 200 rows in = it. =20 I have 2 other tables that have about 300,000 rows each that reference the = first=20 table through a foriegn key.  I run a process that rebuilds these=20 tables.  First I delete the rows in the large tables (takes about 30= =20 seconds), then I delete the the rows in the first table (takes about 5 minu= tes=20 !!!).  Each of these are done in separate transactions.
 
If I do a vacuum analyze on each of the la= rge=20 tables just after the delete then deleting the rows from the first table ta= kes=20 just a second or two.  My guess is that postgres is still check the fo= riegn=20 keys from the first table to the others even though the records are deleted= in=20 the larger tables.  The vacuum cleans up the deleted records, so it go= es=20 faster.  Am I wrong.  Any ideas?
 
Regards,
Adam
 
 
------=_NextPart_000_00C7_01C26956.C11136F0-- From pgsql-general-owner@postgresql.org Fri Oct 4 09:38:41 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E7A74476944; Tue, 1 Oct 2002 17:45:12 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 46748476943; Tue, 1 Oct 2002 17:45:12 -0400 (EDT) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1736581; Tue, 01 Oct 2002 14:45:44 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Adam Siegel" , , Subject: Re: [pgsql-performance] Deletes from tables with foreign keys taking too long Date: Tue, 1 Oct 2002 14:44:05 -0700 X-Mailer: KMail [version 1.4] References: <00ca01c26978$490ee4a0$1537140a@orbital.com> In-Reply-To: <00ca01c26978$490ee4a0$1537140a@orbital.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210011444.05157.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/210 X-Sequence-Number: 31208 Adam, > I have a table that has about 200 rows in it. I have 2 other tables that > have about 300,000 rows each that reference the first table through a > foriegn key. I run a process that rebuilds these tables. First I delete > the rows in the large tables (takes about 30 seconds), then I delete the > the rows in the first table (takes about 5 minutes !!!). Each of these a= re > done in separate transactions. Not that this answers your performance questions, but you will be able to d= o=20 this faster if you use TRUNCATE instead of DELETE. --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Oct 1 17:52:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 41A164762C6 for ; Tue, 1 Oct 2002 17:52:37 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 911D74762FD for ; Tue, 1 Oct 2002 17:52:36 -0400 (EDT) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1736597 for pgsql-performance@postgresql.org; Tue, 01 Oct 2002 14:53:08 -0700 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Organization: Aglio Database Solutions To: Subject: Comparitive UPDATE speed Date: Tue, 1 Oct 2002 14:51:29 -0700 X-Mailer: KMail [version 1.4] MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210011451.29254.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/4 X-Sequence-Number: 21 Relative performance question: I have 2 UPDATE queires in a function.=20 table_a: 117,000 records table_b: 117,000 records table_c: 1.5 million records #1 updates table_a, field_2 from table_b, field_1 based on a joining field= _3.=20 Around 110,000 updates #2 updates table_a, field_5 from table_c, field_2 joining on field_3.=20=20 Around 110,000 updates. #1 takes 5-7 minutes; #2 takes about 15 seconds. The only difference I can= =20 discern is that table_a, field_2 is indexed and table_a, field_5 is not. Is it reasonable that updating the index would actually make the query take= =20 20x longer? If not, I'll post actual table defs and query statements. --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Oct 1 19:49:49 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 41A97476133 for ; Tue, 1 Oct 2002 19:49:48 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 9595A476053 for ; Tue, 1 Oct 2002 19:49:47 -0400 (EDT) Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1736716; Tue, 01 Oct 2002 16:50:21 -0700 From: "Josh Berkus" Subject: Re: Comparitive UPDATE speed To: Randy Neumann , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 01 Oct 2002 16:50:21 -0700 Message-ID: In-Reply-To: <200210012311.RAA51034@mail.simn.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/5 X-Sequence-Number: 22 Randy, > I'm not sure about 20 times longer but you would have index records > that > would need to be changed. Is field_3 indexed in all 3 tables? If > table_b > does not have an index on field_3 and the other tables do, I'd guess > that > would make this take longer too. Yeah, they're indexed. I'm going to try the updates without the index on field_2 tonight. -Josh Berkus From pgsql-performance-owner@postgresql.org Wed Oct 2 06:50:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F2D22475CA6 for ; Wed, 2 Oct 2002 06:50:02 -0400 (EDT) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by postgresql.org (Postfix) with ESMTP id 63884475C26 for ; Wed, 2 Oct 2002 06:50:02 -0400 (EDT) Received: from localhost.localdomain ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021002105005.YRNI12192.lakemtao02.cox.net@localhost.localdomain> for ; Wed, 2 Oct 2002 06:50:05 -0400 Subject: Re: Comparitive UPDATE speed From: Ron Johnson To: pgsql-performance@postgresql.org In-Reply-To: <200210011451.29254.josh@agliodbs.com> References: <200210011451.29254.josh@agliodbs.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 02 Oct 2002 05:48:01 -0500 Message-Id: <1033555682.28068.23.camel@haggis> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/6 X-Sequence-Number: 23 On Tue, 2002-10-01 at 16:51, Josh Berkus wrote: > Relative performance question: > > I have 2 UPDATE queires in a function. > > table_a: 117,000 records > table_b: 117,000 records > table_c: 1.5 million records > > #1 updates table_a, field_2 from table_b, field_1 based on a joining field_3. > Around 110,000 updates > #2 updates table_a, field_5 from table_c, field_2 joining on field_3. > Around 110,000 updates. > > #1 takes 5-7 minutes; #2 takes about 15 seconds. The only difference I can > discern is that table_a, field_2 is indexed and table_a, field_5 is not. > > Is it reasonable that updating the index would actually make the query take > 20x longer? If not, I'll post actual table defs and query statements. Absolutely. You are doing lots of extra work. For each of the 110,000 updates, you are deleting a leaf node from one part of the index tree and then inserting it into another part of the tree. It will get even worse as you add more rows to table_a, since the index tree will get deeper, and more work work must be done during each insert and delete. -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "What other evidence do you have that they are terrorists, | | other than that they trained in these camps?" | | 17-Sep-2002 Katie Couric to an FBI agent regarding the 5 | | men arrested near Buffalo NY | +------------------------------------------------------------+ From pgsql-general-owner@postgresql.org Thu Oct 3 08:35:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 45BC5476237 for ; Thu, 3 Oct 2002 08:35:40 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 79B41476228 for ; Thu, 3 Oct 2002 08:35:38 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93Cb8l17916 for ; Thu, 3 Oct 2002 18:07:08 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93Cb7v17906; Thu, 3 Oct 2002 18:07:07 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org Date: Thu, 03 Oct 2002 18:06:10 +0530 MIME-Version: 1.0 Content-type: Multipart/Mixed; boundary=Message-Boundary-2419 Subject: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Cc: pgsql-general , "pankaj M. Tolani" Message-ID: <3D9C8712.9513.9C6521D@localhost> X-mailer: Pegasus Mail for Windows (v4.02) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/115 X-Sequence-Number: 31114 --Message-Boundary-2419 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Hi, Today we concluded test for database performance. Attached are results and the schema, for those who have missed earlier discussion on this. We have (almost) decided that we will partition the data across machines. The theme is, after every some short interval a burst of data will be entered in new table in database, indexed and vacuume. The table(s) will be inherited so that query on base table will fetch results from all the children. The application has to consolidate all the data per node basis. If the database is not postgresql, app. has to consolidate data across partitions as well. Now we need to investigate whether selecting on base table to include children would use indexes created on children table. It's estimated that when entire data is gathered, total number of children tables would be around 1K-1.1K across all machines. This is in point of average rate of data insertion i.e. 5K records/sec and total data size, estimated to be 9 billion rows max i.e. estimated database size is 900GB. Obviously it's impossible to keep insertion rate on an indexed table high as data grows. So partitioning/inheritance looks better approach. Postgresql is not the final winner as yet. Mysql is in close range. I will keep you guys posted about the result. Let me know about any comments.. Bye Shridhar -- Price's Advice: It's all a game -- play it to have fun. --Message-Boundary-2419 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Text from file 'pgbenchmark.txt' Machine Compaq Proliant Server ML 530 "Intel Xeon 2.4 Ghz Processor x 4, " "4 GB RAM, 5 x 72.8 GB SCSI HDD " "RAID 0 (Striping) Hardware Setup, Mandrake Linux 9.0" "Cost - $13,500 ($1,350 for each additional 72GB HDD)" Performance Parameter MySQL 3.23.52 MySQL 3.23.52 PostgreSQL 7.2.2 WITHOUT InnoDB WITH InnoDB for with built-in support for transactional transactional support for transactions support Complete Data Inserts + building a composite index "40 GB data, 432,000,000 tuples" 3738 secs 18720 secs 20628 secs "about 100 bytes each, schema on 'schema' sheet" "composite index on 3 fields (esn, min, datetime)" Load Speed 115570 tuples/second 23076 tuples/second 20942 tuples/second Database Size on Disk 48 GB 87 GB 111 GB Average per partition Inserts + building a composite index "300MB data, 3,000,000 tuples," 28 secs 130 secs 150 secs "about 100 bytes each, schema on 'schema' sheet" "composite index on 3 fields (esn, min, datetime)" Select Query 7 secs 7 secs 6 secs based on equality match of 2 fields (esn and min) - 4 concurrent queries running Database Size on Disk 341 MB 619 MB 788 MB --Message-Boundary-2419 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Text from file 'schema.txt' Field Name Field Type Nullable Indexed type int no no esn char (10) no yes min char (10) no yes datetime timestamp no yes opc0 char (3) no no opc1 char (3) no no opc2 char (3) no no dpc0 char (3) no no dpc1 char (3) no no dpc2 char (3) no no npa char (3) no no nxx char (3) no no rest char (4) no no field0 int yes no field1 char (4) yes no field2 int yes no field3 char (4) yes no field4 int yes no field5 char (4) yes no field6 int yes no field7 char (4) yes no field8 int yes no field9 char (4) yes no --Message-Boundary-2419-- From pgsql-general-owner@postgresql.org Thu Oct 3 08:54:34 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 77A89476228; Thu, 3 Oct 2002 08:54:32 -0400 (EDT) Received: from clearmetrix.com (unknown [209.92.142.67]) by postgresql.org (Postfix) with ESMTP id 9462F476223; Thu, 3 Oct 2002 08:54:30 -0400 (EDT) Received: from clearmetrix.com (chw.muvpn.clearmetrix.com [172.16.1.3] (may be forged)) by clearmetrix.com (8.11.6/linuxconf) with ESMTP id g93CsQV11899; Thu, 3 Oct 2002 08:54:26 -0400 Message-ID: <3D9C3E05.7070906@clearmetrix.com> Date: Thu, 03 Oct 2002 08:54:29 -0400 From: "Charles H. Woloszynski" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , "pankaj M. Tolani" Subject: Re: Large databases, performance References: <3D9C8712.9513.9C6521D@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/116 X-Sequence-Number: 31115 Can you comment on the tools you are using to do the insertions (Perl, Java?) and the distribution of data (all random, all static), and the transaction scope (all inserts in one transaction, each insert as a single transaction, some group of inserts as a transaction). I'd be curious what happens when you submit more queries than you have processors (you had four concurrent queries and four CPUs), if you care to run any additional tests. Also, I'd report the query time in absolute (like you did) and also in 'Time/number of concurrent queries". This will give you a sense of how the system is scaling as the workload increases. Personally I am more concerned about this aspect than the load time, since I am going to guess that this is where all the time is spent. Was the original posting on GENERAL or HACKERS. Is this moving the PERFORMANCE for follow-up? I'd like to follow this discussion and want to know if I should join another group? Thanks, Charlie P.S. Anyone want to comment on their expectation for 'commercial' databases handling this load? I know that we cannot speak about specific performance metrics on some products (licensing restrictions) but I'd be curious if folks have seen some of the databases out there handle these dataset sizes and respond resonably. Shridhar Daithankar wrote: >Hi, > >Today we concluded test for database performance. Attached are results and the >schema, for those who have missed earlier discussion on this. > >We have (almost) decided that we will partition the data across machines. The >theme is, after every some short interval a burst of data will be entered in >new table in database, indexed and vacuume. The table(s) will be inherited so >that query on base table will fetch results from all the children. The >application has to consolidate all the data per node basis. If the database is >not postgresql, app. has to consolidate data across partitions as well. > >Now we need to investigate whether selecting on base table to include children >would use indexes created on children table. > >It's estimated that when entire data is gathered, total number of children >tables would be around 1K-1.1K across all machines. > >This is in point of average rate of data insertion i.e. 5K records/sec and >total data size, estimated to be 9 billion rows max i.e. estimated database >size is 900GB. Obviously it's impossible to keep insertion rate on an indexed >table high as data grows. So partitioning/inheritance looks better approach. > >Postgresql is not the final winner as yet. Mysql is in close range. I will keep >you guys posted about the result. > >Let me know about any comments.. > >Bye > Shridhar > >-- >Price's Advice: It's all a game -- play it to have fun. > > > > >------------------------------------------------------------------------ > >Machine >Compaq Proliant Server ML 530 >"Intel Xeon 2.4 Ghz Processor x 4, " >"4 GB RAM, 5 x 72.8 GB SCSI HDD " >"RAID 0 (Striping) Hardware Setup, Mandrake Linux 9.0" >"Cost - $13,500 ($1,350 for each additional 72GB HDD)" > >Performance Parameter MySQL 3.23.52 MySQL 3.23.52 PostgreSQL 7.2.2 > WITHOUT InnoDB WITH InnoDB for with built-in support > for transactional transactional support for transactions > support >Complete Data > >Inserts + building a composite index >"40 GB data, 432,000,000 tuples" 3738 secs 18720 secs 20628 secs >"about 100 bytes each, schema on >'schema' sheet" >"composite index on 3 fields >(esn, min, datetime)" > >Load Speed 115570 tuples/second 23076 tuples/second 20942 tuples/second > >Database Size on Disk 48 GB 87 GB 111 GB > >Average per partition > >Inserts + building a composite index >"300MB data, 3,000,000 tuples," 28 secs 130 secs 150 secs >"about 100 bytes each, schema on >'schema' sheet" >"composite index on 3 fields >(esn, min, datetime)" > >Select Query 7 secs 7 secs 6 secs >based on equality match of 2 fields >(esn and min) - 4 concurrent queries >running > >Database Size on Disk 341 MB 619 MB 788 MB > > >------------------------------------------------------------------------ > >Field Name Field Type Nullable Indexed >type int no no >esn char (10) no yes >min char (10) no yes >datetime timestamp no yes >opc0 char (3) no no >opc1 char (3) no no >opc2 char (3) no no >dpc0 char (3) no no >dpc1 char (3) no no >dpc2 char (3) no no >npa char (3) no no >nxx char (3) no no >rest char (4) no no >field0 int yes no >field1 char (4) yes no >field2 int yes no >field3 char (4) yes no >field4 int yes no >field5 char (4) yes no >field6 int yes no >field7 char (4) yes no >field8 int yes no >field9 char (4) yes no > > > >------------------------------------------------------------------------ > > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > -- Charles H. Woloszynski ClearMetrix, Inc. 115 Research Drive Bethlehem, PA 18015 tel: 610-419-2210 x400 fax: 240-371-3256 web: www.clearmetrix.com From pgsql-general-owner@postgresql.org Thu Oct 3 08:56:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 759394762F8 for ; Thu, 3 Oct 2002 08:56:01 -0400 (EDT) Received: from smtp.investsystems.co.uk (unknown [62.49.196.163]) by postgresql.org (Postfix) with SMTP id 5512347625C for ; Thu, 3 Oct 2002 08:56:00 -0400 (EDT) Received: (qmail 61099 invoked from network); 3 Oct 2002 12:56:03 -0000 Received: from ponder.fairway2k.co.uk (nandrews@172.31.1.3) by hex.fairway2k.co.uk with SMTP; 3 Oct 2002 12:56:03 -0000 Date: Thu, 3 Oct 2002 13:56:03 +0100 (BST) From: "Nigel J. Andrews" X-Sender: nandrews@ponder.fairway2k.co.uk To: Shridhar Daithankar Cc: pgsql-general Subject: Re: Large databases, performance In-Reply-To: <3D9C8712.9513.9C6521D@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/117 X-Sequence-Number: 31116 Shridhar, It's one hell of a DB you're building. I'm sure I'm not the only one interested so to satisfy those of us who are nosey: can you say what the application is? I'm sure we'll all understand if it's not possible for you mention such information. -- Nigel J. Andrews On Thu, 3 Oct 2002, Shridhar Daithankar wrote: > Hi, > > Today we concluded test for database performance. Attached are results and the > schema, for those who have missed earlier discussion on this. > > We have (almost) decided that we will partition the data across machines. The > theme is, after every some short interval a burst of data will be entered in > new table in database, indexed and vacuume. The table(s) will be inherited so > that query on base table will fetch results from all the children. The > application has to consolidate all the data per node basis. If the database is > not postgresql, app. has to consolidate data across partitions as well. > > Now we need to investigate whether selecting on base table to include children > would use indexes created on children table. > > It's estimated that when entire data is gathered, total number of children > tables would be around 1K-1.1K across all machines. > > This is in point of average rate of data insertion i.e. 5K records/sec and > total data size, estimated to be 9 billion rows max i.e. estimated database > size is 900GB. Obviously it's impossible to keep insertion rate on an indexed > table high as data grows. So partitioning/inheritance looks better approach. > > Postgresql is not the final winner as yet. Mysql is in close range. I will keep > you guys posted about the result. > > Let me know about any comments.. > > Bye > Shridhar From pgsql-general-owner@postgresql.org Thu Oct 3 10:03:00 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3AC1A475C22 for ; Thu, 3 Oct 2002 10:02:59 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id AA735475AFA for ; Thu, 3 Oct 2002 10:02:57 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93E4S327165 for ; Thu, 3 Oct 2002 19:34:28 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93E4Rv27160 for ; Thu, 3 Oct 2002 19:34:27 +0530 From: "Shridhar Daithankar" To: pgsql-general Date: Thu, 03 Oct 2002 19:33:30 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3D9C9B8A.30310.A16469F@localhost> References: <3D9C8712.9513.9C6521D@localhost> In-reply-to: X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/120 X-Sequence-Number: 31119 On 3 Oct 2002 at 13:56, Nigel J. Andrews wrote: > It's one hell of a DB you're building. I'm sure I'm not the only one interested > so to satisfy those of us who are nosey: can you say what the application is? > > I'm sure we'll all understand if it's not possible for you mention such > information. Well, I can't tell everything but somethings I can.. 1) This is a system that does not have online capability yet. This is an attempt to provide one. 2) The goal is to avoid costs like licensing oracle. I am sure this would make a great example for OSDB advocacy, which ever database wins.. 3) The database size estimates, I put earlier i.e. 9 billion tuples/900GB data size, are in a fixed window. The data is generated from some real time systems. You can imagine the rate. 4) Further more there are timing restrictions attached to it. 5K inserts/sec. 4800 queries per hour with response time of 10 sec. each. It's this aspect that has forced us for partitioning.. And contrary to my earlier information, this is going to be a live system rather than a back up one.. A better win to postgresql.. I hope it makes it. And BTW, all these results were on reiserfs. We didn't found much of difference in write performance between them. So we stick to reiserfs. And of course we got the latest hot shot Mandrake9 with 2.4.19-16 which really made difference over RHL7.2.. Bye Shridhar -- QOTD: "Do you smell something burning or is it me?" -- Joan of Arc From pgsql-general-owner@postgresql.org Thu Oct 3 10:27:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 00D77475E82 for ; Thu, 3 Oct 2002 10:27:02 -0400 (EDT) Received: from clearmetrix.com (unknown [209.92.142.67]) by postgresql.org (Postfix) with ESMTP id 4C84D475C9E for ; Thu, 3 Oct 2002 10:27:01 -0400 (EDT) Received: from clearmetrix.com (chw.muvpn.clearmetrix.com [172.16.1.3] (may be forged)) by clearmetrix.com (8.11.6/linuxconf) with ESMTP id g93ER0V13724; Thu, 3 Oct 2002 10:27:00 -0400 Message-ID: <3D9C53B3.2050508@clearmetrix.com> Date: Thu, 03 Oct 2002 10:26:59 -0400 From: "Charles H. Woloszynski" X-Accept-Language: en-us, en MIME-Version: 1.0 To: shridhar_daithankar@persistent.co.in Cc: pgsql-general Subject: Re: Large databases, performance References: <3D9C8712.9513.9C6521D@localhost> <3D9C9B8A.30310.A16469F@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/121 X-Sequence-Number: 31120 Forgive my ignorance, but what about 2.4.19-16 is that much faster? Are we talking about 2x improvement for your tests? We are currently on 2.4.9 and looking at the performance and wondering... so any comments are appreciated. Charlie Shridhar Daithankar wrote: >And BTW, all these results were on reiserfs. We didn't found much of difference >in write performance between them. So we stick to reiserfs. And of course we >got the latest hot shot Mandrake9 with 2.4.19-16 which really made difference >over RHL7.2.. > >Bye > Shridhar > >-- >QOTD: "Do you smell something burning or is it me?" -- Joan of Arc > > >---------------------------(end of broadcast)--------------------------- >TIP 5: Have you checked our extensive FAQ? > >http://www.postgresql.org/users-lounge/docs/faq.html > > -- Charles H. Woloszynski ClearMetrix, Inc. 115 Research Drive Bethlehem, PA 18015 tel: 610-419-2210 x400 fax: 240-371-3256 web: www.clearmetrix.com From pgsql-general-owner@postgresql.org Thu Oct 3 11:49:44 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6EFF2475D12 for ; Thu, 3 Oct 2002 11:49:43 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id EFE17475C15 for ; Thu, 3 Oct 2002 11:49:41 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93FpDP03689 for ; Thu, 3 Oct 2002 21:21:13 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93FpDv03684 for ; Thu, 3 Oct 2002 21:21:13 +0530 From: "Shridhar Daithankar" To: pgsql-general Date: Thu, 03 Oct 2002 21:20:16 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3D9CB490.2412.A78039E@localhost> In-reply-to: <3D9C53B3.2050508@clearmetrix.com> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/125 X-Sequence-Number: 31124 On 3 Oct 2002 at 10:26, Charles H. Woloszynski wrote: > Forgive my ignorance, but what about 2.4.19-16 is that much faster? Are > we talking about 2x improvement for your tests? We are currently on > 2.4.9 and looking at the performance and wondering... so any comments > are appreciated. Well, for one thing, 2.4.19 contains backported O(1) scheduler patch which improves SMP performance by heaps as task queue is per cpu rather than one per system. I don't think any system routinely runs thousands of processes unless it's a web/ftp/mail server. In that case improved scheduling wuld help as well.. Besides there were major VM rewrites/changes after 2.4.10 which corrected almost all the major VM fiaskos on linux. For anything VM intensive it's recommended that you run 2.4.17 at least. I would say it's worth going for it. Bye Shridhar -- Sturgeon's Law: 90% of everything is crud. From pgsql-general-owner@postgresql.org Thu Oct 3 11:56:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 260004767C0 for ; Thu, 3 Oct 2002 11:56:13 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 50F1D476759 for ; Thu, 3 Oct 2002 11:56:11 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93Fvfs04051 for ; Thu, 3 Oct 2002 21:27:41 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93Fvfv04044; Thu, 3 Oct 2002 21:27:41 +0530 From: "Shridhar Daithankar" To: pgsql-general Date: Thu, 03 Oct 2002 21:26:43 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org Message-ID: <3D9CB613.1700.A7DEEF0@localhost> In-reply-to: <3D9C9B8A.30310.A16469F@localhost> References: X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/126 X-Sequence-Number: 31125 On 3 Oct 2002 at 19:33, Shridhar Daithankar wrote: > On 3 Oct 2002 at 13:56, Nigel J. Andrews wrote: > > It's one hell of a DB you're building. I'm sure I'm not the only one interested > > so to satisfy those of us who are nosey: can you say what the application is? > > > > I'm sure we'll all understand if it's not possible for you mention such > > information. > > Well, I can't tell everything but somethings I can.. > > 1) This is a system that does not have online capability yet. This is an > attempt to provide one. > > 2) The goal is to avoid costs like licensing oracle. I am sure this would make > a great example for OSDB advocacy, which ever database wins.. > > 3) The database size estimates, I put earlier i.e. 9 billion tuples/900GB data > size, are in a fixed window. The data is generated from some real time systems. > You can imagine the rate. Read that fixed time window.. > > 4) Further more there are timing restrictions attached to it. 5K inserts/sec. > 4800 queries per hour with response time of 10 sec. each. It's this aspect that > has forced us for partitioning.. > > And contrary to my earlier information, this is going to be a live system > rather than a back up one.. A better win to postgresql.. I hope it makes it. > > And BTW, all these results were on reiserfs. We didn't found much of difference > in write performance between them. So we stick to reiserfs. And of course we > got the latest hot shot Mandrake9 with 2.4.19-16 which really made difference > over RHL7.2.. Well, we were comparing ext3 v/s reiserfs. I don't remember the journalling mode of ext3 but we did a 10 GB write test. Besides converting the RAID to RAID- 0 from RAID-5 might have something to do about it. There was a discussion on hackers some time back as in which file system is better. I hope this might have an addition over it.. Bye Shridhar -- "What terrible way to die." "There are no good ways." -- Sulu and Kirk, "That Which Survives", stardate unknown From pgsql-general-owner@postgresql.org Thu Oct 3 12:01:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E7F9D4766C8; Thu, 3 Oct 2002 12:01:39 -0400 (EDT) Received: from briar.mmrd.com (unknown [208.255.226.182]) by postgresql.org (Postfix) with ESMTP id 25AD3476664; Thu, 3 Oct 2002 12:01:39 -0400 (EDT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by briar.mmrd.com (8.11.2/8.11.2) with ESMTP id g93GxIF30272; Thu, 3 Oct 2002 12:59:18 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id g93G1Zx29595; Thu, 3 Oct 2002 12:01:35 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id TK2FXAW3; Thu, 3 Oct 2002 12:01:34 -0400 Subject: Re: Large databases, performance From: Robert Treat Reply-To: pgsql-performance@postgresql.org To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , "pankaj M. Tolani" In-Reply-To: <3D9C8712.9513.9C6521D@localhost> References: <3D9C8712.9513.9C6521D@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 03 Oct 2002 11:57:29 -0400 Message-Id: <1033660649.21324.53.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/128 X-Sequence-Number: 31127 NOTE: Setting follow up to the performance list Funny that the status quo seems to be if you need fast selects on data that has few inserts to pick mysql, otherwise if you have a lot of inserts and don't need super fast selects go with PostgreSQL; yet your data seems to cut directly against this. I'm curious, did you happen to run the select tests while also running the insert tests? IIRC the older mysql versions have to lock the table when doing the insert, so select performance goes in the dumper in that scenario, perhaps that's not an issue with 3.23.52? It also seems like the vacuum after each insert is unnecessary, unless your also deleting/updating data behind it. Perhaps just running an ANALYZE on the table would suffice while reducing overhead. Robert Treat On Thu, 2002-10-03 at 08:36, Shridhar Daithankar wrote: > Machine > Compaq Proliant Server ML 530 > "Intel Xeon 2.4 Ghz Processor x 4, " > "4 GB RAM, 5 x 72.8 GB SCSI HDD " > "RAID 0 (Striping) Hardware Setup, Mandrake Linux 9.0" > "Cost - $13,500 ($1,350 for each additional 72GB HDD)" > > Performance Parameter MySQL 3.23.52 MySQL 3.23.52 PostgreSQL 7.2.2 > WITHOUT InnoDB WITH InnoDB for with built-in support > for transactional transactional support for transactions > support > Complete Data > > Inserts + building a composite index > "40 GB data, 432,000,000 tuples" 3738 secs 18720 secs 20628 secs > "about 100 bytes each, schema on > 'schema' sheet" > "composite index on 3 fields > (esn, min, datetime)" > > Load Speed 115570 tuples/second 23076 tuples/second 20942 tuples/second > > Database Size on Disk 48 GB 87 GB 111 GB > > Average per partition > > Inserts + building a composite index > "300MB data, 3,000,000 tuples," 28 secs 130 secs 150 secs > "about 100 bytes each, schema on > 'schema' sheet" > "composite index on 3 fields > (esn, min, datetime)" > > Select Query 7 secs 7 secs 6 secs > based on equality match of 2 fields > (esn and min) - 4 concurrent queries > running > > Database Size on Disk 341 MB 619 MB 788 MB > ---- From pgsql-general-owner@postgresql.org Thu Oct 3 12:07:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 75AB4476A9F for ; Thu, 3 Oct 2002 12:07:24 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id A6610476A98 for ; Thu, 3 Oct 2002 12:07:22 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93G8qH04685 for ; Thu, 3 Oct 2002 21:38:52 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93G8qv04675; Thu, 3 Oct 2002 21:38:52 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-general Date: Thu, 03 Oct 2002 21:37:55 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3D9CB8B3.25411.A882D21@localhost> In-reply-to: <3D9C3E05.7070906@clearmetrix.com> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/130 X-Sequence-Number: 31129 On 3 Oct 2002 at 8:54, Charles H. Woloszynski wrote: > Can you comment on the tools you are using to do the insertions (Perl, > Java?) and the distribution of data (all random, all static), and the > transaction scope (all inserts in one transaction, each insert as a > single transaction, some group of inserts as a transaction). Most proably it's all inserts in one transaction spread almost uniformly over around 15-20 tables. Of course there will be bunch of transactions.. > I'd be curious what happens when you submit more queries than you have > processors (you had four concurrent queries and four CPUs), if you care > to run any additional tests. Also, I'd report the query time in > absolute (like you did) and also in 'Time/number of concurrent queries". > This will give you a sense of how the system is scaling as the workload > increases. Personally I am more concerned about this aspect than the > load time, since I am going to guess that this is where all the time is > spent. I don't think so. Because we plan to put enough shared buffers that would almost contain the indexes in RAM if not data. Besides number of tuples expected per query are not many. So more concurrent queries are not going to hog anything other than CPU power at most. Our major concern remains load time as data is generated in real time and is expecetd in database with in specified time period. We need indexes for query and inserting into indexed table is on hell of a job. We did attempt inserting 8GB of data in indexed table. It took almost 20 hours at 1K tuples per second on average.. Though impressive it's not acceptable for that load.. > > Was the original posting on GENERAL or HACKERS. Is this moving the > PERFORMANCE for follow-up? I'd like to follow this discussion and want > to know if I should join another group? Shall I subscribe to performance? What's the exat list name? Benchmarks? I don't see anything as performance mailing list on this page.. http://developer.postgresql.org/mailsub.php?devlp > P.S. Anyone want to comment on their expectation for 'commercial' > databases handling this load? I know that we cannot speak about > specific performance metrics on some products (licensing restrictions) > but I'd be curious if folks have seen some of the databases out there > handle these dataset sizes and respond resonably. Well, if something handles such kind of data with single machine and costs under USD20K for entire setup, I would be willing to recommend that to client.. BTW we are trying same test on HP-UX. I hope we get some better figures on 64 bit machines.. Bye Shridhar -- Clarke's Conclusion: Never let your sense of morals interfere with doing the right thing. From pgsql-general-owner@postgresql.org Thu Oct 3 12:16:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6A4E54766BA; Thu, 3 Oct 2002 12:16:11 -0400 (EDT) Received: from new-smtp2.ihug.com.au (new-smtp2.ihug.com.au [203.109.250.28]) by postgresql.org (Postfix) with ESMTP id 88893476606; Thu, 3 Oct 2002 12:16:10 -0400 (EDT) Received: from p286-tnt1.mel.ihug.com.au (postgresql.org) [203.173.161.32] by new-smtp2.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 17x8e0-0002c2-00; Fri, 04 Oct 2002 02:16:09 +1000 Message-ID: <3D9C6D46.CCDB3047@postgresql.org> Date: Fri, 04 Oct 2002 02:16:06 +1000 From: Justin Clift X-Mailer: Mozilla 4.79 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general Subject: Re: [HACKERS] Large databases, performance References: <3D9CB8B3.25411.A882D21@localhost> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/134 X-Sequence-Number: 31133 Shridhar Daithankar wrote: > > Was the original posting on GENERAL or HACKERS. Is this moving the > > PERFORMANCE for follow-up? I'd like to follow this discussion and want > > to know if I should join another group? > > Shall I subscribe to performance? What's the exat list name? Benchmarks? I > don't see anything as performance mailing list on this page.. > http://developer.postgresql.org/mailsub.php?devlp It's a fairly new mailing list. :) pgsql-performance@postgresql.org Easiest way to subscribe is by emailing majordomo@postgresql.org with: subscribe pgsql-performance as the message body. :-) Regards and best wishes, Justin Clift > Bye > Shridhar > > -- > Clarke's Conclusion: Never let your sense of morals interfere with doing the > right thing. > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi From pgsql-general-owner@postgresql.org Thu Oct 3 12:16:51 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3DDFC476B00 for ; Thu, 3 Oct 2002 12:16:50 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 4CDE247675B for ; Thu, 3 Oct 2002 12:16:29 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93GI1E05284 for ; Thu, 3 Oct 2002 21:48:01 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93GI1v05269; Thu, 3 Oct 2002 21:48:01 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org, pgsql-general , "pankaj M. Tolani" Date: Thu, 03 Oct 2002 21:47:03 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3D9CBAD7.23509.A908C61@localhost> References: <3D9C8712.9513.9C6521D@localhost> In-reply-to: <1033660649.21324.53.camel@camel> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/135 X-Sequence-Number: 31134 On 3 Oct 2002 at 11:57, Robert Treat wrote: > NOTE: Setting follow up to the performance list > > Funny that the status quo seems to be if you need fast selects on data > that has few inserts to pick mysql, otherwise if you have a lot of > inserts and don't need super fast selects go with PostgreSQL; yet your > data seems to cut directly against this. Well, couple of things.. The number of inserts aren't few. it's 5000/sec.required in the field Secondly I don't know really but postgresql seems doing pretty fine in parallel selects. If we use mysql with transaction support then numbers are really close.. May be it's time to rewrite famous myth that postgresql is slow. When properly tuned or given enough head room, it's almost as fast as mysql.. > I'm curious, did you happen to run the select tests while also running > the insert tests? IIRC the older mysql versions have to lock the table > when doing the insert, so select performance goes in the dumper in that > scenario, perhaps that's not an issue with 3.23.52? IMO even if it locks tables that shouldn't affect select performance. It would be fun to watch when we insert multiple chunks of data and fire queries concurrently. I would be surprised if mysql starts slowing down.. > It also seems like the vacuum after each insert is unnecessary, unless > your also deleting/updating data behind it. Perhaps just running an > ANALYZE on the table would suffice while reducing overhead. I believe that was vacuum analyze only. But still it takes lot of time. Good thing is it's not blocking.. Anyway I don't think such frequent vacuums are going to convince planner to choose index scan over sequential scan. I am sure it's already convinced.. Regards, Shridhar ----------------------------------------------------------- Shridhar Daithankar LIMS CPE Team Member, PSPL. mailto:shridhar_daithankar@persistent.co.in Phone:- +91-20-5678900 Extn.270 Fax :- +91-20-5678901 ----------------------------------------------------------- From pgsql-general-owner@postgresql.org Thu Oct 3 12:23:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 96B8E475B8C; Thu, 3 Oct 2002 12:23:39 -0400 (EDT) Received: from CopelandConsulting.Net (dsl-24293-ld.customer.centurytel.net [209.142.135.135]) by postgresql.org (Postfix) with ESMTP id A04A547674F; Thu, 3 Oct 2002 12:23:37 -0400 (EDT) Received: from mouse.copelandconsulting.net (mouse.copelandconsulting.net [192.168.1.2]) by CopelandConsulting.Net (8.10.1/8.10.1) with ESMTP id g93GNMd20304; Thu, 3 Oct 2002 11:23:23 -0500 (CDT) X-Trade-Id: To: shridhar_daithankar@persistent.co.in Cc: pgsql-general , PostgresSQL Hackers Mailing List In-Reply-To: <3D9CB613.1700.A7DEEF0@localhost> References: <3D9CB613.1700.A7DEEF0@localhost> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-UufspPzcV77dAnLY19zJ" X-Mailer: Ximian Evolution 1.0.8 Date: 03 Oct 2002 11:23:28 -0500 Message-Id: <1033662208.13005.22.camel@mouse.copelandconsulting.net> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/137 X-Sequence-Number: 31136 --=-UufspPzcV77dAnLY19zJ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2002-10-03 at 10:56, Shridhar Daithankar wrote: > Well, we were comparing ext3 v/s reiserfs. I don't remember the journalli= ng=20 > mode of ext3 but we did a 10 GB write test. Besides converting the RAID t= o RAID- > 0 from RAID-5 might have something to do about it. >=20 > There was a discussion on hackers some time back as in which file system = is=20 > better. I hope this might have an addition over it.. Hmm. Reiserfs' claim to fame is it's low latency with many, many small files and that it's journaled. I've never seem anyone comment about it being considered an extremely fast file system in an general computing context nor have I seen any even hint at it as a file system for use in heavy I/O databases. This is why Reiserfs is popular with news and squid cache servers as it's almost an ideal fit. That is, tons of small files or directories contained within a single directory. As such, I'm very surprised that reiserfs is even in the running for your comparison. Might I point you toward XFS, JFS, or ext3, ? As I understand it, XFS and JFS are going to be your preferred file systems for for this type of application with XFS in the lead as it's tool suite is very rich and robust. I'm actually lacking JFS experience but from what I've read, it's a notch or two back from XFS in robustness (assuming we are talking Linux here). Feel free to read and play to find out for your self. I'd recommend that you start playing with XFS to see how the others compare. After all, XFS' specific claim to fame is high throughput w/ low latency on large and very large files. Furthermore, they even have a real time mechanism that you can further play with to see how it effects your throughput and/or latencies. Greg --=-UufspPzcV77dAnLY19zJ Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) iD8DBQA9nG7/4lr1bpbcL6kRAseVAJwLTzthd4qA47FItNsq5IWk2LPeZACfeoR8 jeimwzplmrQ8azABtU/ZxEI= =K7BL -----END PGP SIGNATURE----- --=-UufspPzcV77dAnLY19zJ-- From pgsql-performance-owner@postgresql.org Thu Oct 3 12:30:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8B3574761D7 for ; Thu, 3 Oct 2002 12:30:35 -0400 (EDT) Received: from briar.mmrd.com (unknown [208.255.226.182]) by postgresql.org (Postfix) with ESMTP id ECCE4476072 for ; Thu, 3 Oct 2002 12:30:34 -0400 (EDT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by briar.mmrd.com (8.11.2/8.11.2) with ESMTP id g93HSMF00312; Thu, 3 Oct 2002 13:28:22 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id g93GUex30019; Thu, 3 Oct 2002 12:30:40 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id TK2FXA5P; Thu, 3 Oct 2002 12:30:38 -0400 Subject: Re: Large databases, performance From: Robert Treat To: shridhar_daithankar@persistent.co.in Cc: pgsql-performance@postgresql.org In-Reply-To: <3D9CBAD7.23509.A908C61@localhost> References: <3D9C8712.9513.9C6521D@localhost> <3D9CBAD7.23509.A908C61@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 03 Oct 2002 12:26:34 -0400 Message-Id: <1033662394.21324.59.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/9 X-Sequence-Number: 26 On Thu, 2002-10-03 at 12:17, Shridhar Daithankar wrote: > On 3 Oct 2002 at 11:57, Robert Treat wrote: > May be it's time to rewrite famous myth that postgresql is slow. That myth has been dis-proven long ago, it just takes awhile for everyone to catch on ;-) When properly > tuned or given enough head room, it's almost as fast as mysql.. > > > I'm curious, did you happen to run the select tests while also running > > the insert tests? IIRC the older mysql versions have to lock the table > > when doing the insert, so select performance goes in the dumper in that > > scenario, perhaps that's not an issue with 3.23.52? > > IMO even if it locks tables that shouldn't affect select performance. It would > be fun to watch when we insert multiple chunks of data and fire queries > concurrently. I would be surprised if mysql starts slowing down.. > Hmm... been awhile since I dug into mysql internals, but IIRC once the table was locked, you had to wait for the insert to complete so the table would be unlocked and the select could go through. (maybe this is a myth that I need to get clued in on) > > It also seems like the vacuum after each insert is unnecessary, unless > > your also deleting/updating data behind it. Perhaps just running an > > ANALYZE on the table would suffice while reducing overhead. > > I believe that was vacuum analyze only. But still it takes lot of time. Good > thing is it's not blocking.. > > Anyway I don't think such frequent vacuums are going to convince planner to > choose index scan over sequential scan. I am sure it's already convinced.. > My thinking was that if your just doing inserts, you need to update the statistics but don't need to check on unused tuples. Robert Treat From pgsql-performance-owner@postgresql.org Thu Oct 3 12:29:19 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AA6C4476340 for ; Thu, 3 Oct 2002 12:29:17 -0400 (EDT) Received: from slammer.netnation.com (slammer.netnation.com [204.174.223.62]) by postgresql.org (Postfix) with ESMTP id 3A7484761D7 for ; Thu, 3 Oct 2002 12:29:17 -0400 (EDT) Received: from [10.10.10.11] (helo=mikeb.staff.netnation.com) by slammer.netnation.com with esmtp (Exim 3.36 #1) id 17x8qn-0005Jo-00 for pgsql-performance@postgresql.org; Thu, 03 Oct 2002 09:29:21 -0700 Subject: subscribe pgsql-performance From: Mike Benoit To: pgsql-performance@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8-3mdk Date: 03 Oct 2002 09:29:21 -0700 Message-Id: <1033662562.31473.2.camel@mikeb.staff.netnation.com> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/8 X-Sequence-Number: 25 subscribe pgsql-performance -- Best Regards, Mike Benoit NetNation Communication Inc. Systems Engineer Tel: 604-684-6892 or 888-983-6600 --------------------------------------- Disclaimer: Opinions expressed here are my own and not necessarily those of my employer From pgsql-general-owner@postgresql.org Thu Oct 3 12:29:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B58A54761D7 for ; Thu, 3 Oct 2002 12:29:46 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id C9C8947604E for ; Thu, 3 Oct 2002 12:29:44 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93GVGe06213 for ; Thu, 3 Oct 2002 22:01:16 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93GVGv06203; Thu, 3 Oct 2002 22:01:16 +0530 From: "Shridhar Daithankar" To: Greg Copeland Date: Thu, 03 Oct 2002 22:00:18 +0530 MIME-Version: 1.0 Subject: Re: [HACKERS] Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Cc: pgsql-general , PostgresSQL Hackers Mailing List , "pankaj M. Tolani" Message-ID: <3D9CBDF2.27020.A9CACCF@localhost> References: <3D9CB613.1700.A7DEEF0@localhost> In-reply-to: <1033662208.13005.22.camel@mouse.copelandconsulting.net> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/138 X-Sequence-Number: 31137 On 3 Oct 2002 at 11:23, Greg Copeland wrote: > On Thu, 2002-10-03 at 10:56, Shridhar Daithankar wrote: > > Well, we were comparing ext3 v/s reiserfs. I don't remember the journalling > > mode of ext3 but we did a 10 GB write test. Besides converting the RAID to RAID- > > 0 from RAID-5 might have something to do about it. > > > > There was a discussion on hackers some time back as in which file system is > > better. I hope this might have an addition over it.. > > > Hmm. Reiserfs' claim to fame is it's low latency with many, many small > files and that it's journaled. I've never seem anyone comment about it > being considered an extremely fast file system in an general computing > context nor have I seen any even hint at it as a file system for use in > heavy I/O databases. This is why Reiserfs is popular with news and > squid cache servers as it's almost an ideal fit. That is, tons of small > files or directories contained within a single directory. As such, I'm > very surprised that reiserfs is even in the running for your comparison. > > Might I point you toward XFS, JFS, or ext3, ? As I understand it, XFS > and JFS are going to be your preferred file systems for for this type of > application with XFS in the lead as it's tool suite is very rich and > robust. I'm actually lacking JFS experience but from what I've read, > it's a notch or two back from XFS in robustness (assuming we are talking > Linux here). Feel free to read and play to find out for your self. I'd > recommend that you start playing with XFS to see how the others > compare. After all, XFS' specific claim to fame is high throughput w/ > low latency on large and very large files. Furthermore, they even have > a real time mechanism that you can further play with to see how it > effects your throughput and/or latencies. I would try that. Once we are thr. with tests at our hands.. Bye Shridhar -- "The combination of a number of things to make existence worthwhile." "Yes, the philosophy of 'none,' meaning 'all.'" -- Spock and Lincoln, "The Savage Curtain", stardate 5906.4 From pgsql-performance-owner@postgresql.org Thu Oct 3 12:34:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5D09847604E for ; Thu, 3 Oct 2002 12:34:52 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id A15E4475EF0 for ; Thu, 3 Oct 2002 12:34:49 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g93GaLj06534 for ; Thu, 3 Oct 2002 22:06:21 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g93GaLv06529; Thu, 3 Oct 2002 22:06:21 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Thu, 03 Oct 2002 22:05:24 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Cc: "pankaj M. Tolani" Message-ID: <3D9CBF24.4516.AA1560C@localhost> References: <3D9CBAD7.23509.A908C61@localhost> In-reply-to: <1033662394.21324.59.camel@camel> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/10 X-Sequence-Number: 27 On 3 Oct 2002 at 12:26, Robert Treat wrote: > On Thu, 2002-10-03 at 12:17, Shridhar Daithankar wrote: > > On 3 Oct 2002 at 11:57, Robert Treat wrote: > > May be it's time to rewrite famous myth that postgresql is slow. > > That myth has been dis-proven long ago, it just takes awhile for > everyone to catch on ;-) :-) > Hmm... been awhile since I dug into mysql internals, but IIRC once the > table was locked, you had to wait for the insert to complete so the > table would be unlocked and the select could go through. (maybe this is > a myth that I need to get clued in on) If that turns out to be true, I guess mysql will nose dive out of window.. May be time to run a test that's nearer to real world expectation, especially in terms on concurrency.. I don't think tat will be an issue with mysql with transaction support. The vanilla one might suffer.. Not the other one.. At least theoretically.. > My thinking was that if your just doing inserts, you need to update the > statistics but don't need to check on unused tuples. Any other way of doing that other than vacuum analyze? I thought that was the only way.. Bye Shridhar -- "Even more amazing was the realization that God has Internet access. Iwonder if He has a full newsfeed?"(By Matt Welsh) From pgsql-general-owner@postgresql.org Thu Oct 3 12:43:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E66324762F3 for ; Thu, 3 Oct 2002 12:43:01 -0400 (EDT) Received: from email01.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.97]) by postgresql.org (Postfix) with SMTP id E4F704769D2 for ; Thu, 3 Oct 2002 12:42:52 -0400 (EDT) Received: (qmail 383094 invoked from network); 3 Oct 2002 16:41:49 -0000 Received: from m165p020.dipool.highway.telekom.at (HELO cantor) ([62.46.10.148]) (envelope-sender ) by qmail1rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 3 Oct 2002 16:41:49 -0000 From: Manfred Koizar To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , "pankaj M. Tolani" Subject: Re: Large databases, performance Date: Thu, 03 Oct 2002 18:44:09 +0200 Message-ID: References: <3D9C8712.9513.9C6521D@localhost> In-Reply-To: <3D9C8712.9513.9C6521D@localhost> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/141 X-Sequence-Number: 31140 On Thu, 03 Oct 2002 18:06:10 +0530, "Shridhar Daithankar" wrote: >Machine >Compaq Proliant Server ML 530 >"Intel Xeon 2.4 Ghz Processor x 4, " >"4 GB RAM, 5 x 72.8 GB SCSI HDD " >"RAID 0 (Striping) Hardware Setup, Mandrake Linux 9.0" Shridhar, forgive me if I ask what has been said before: Did you run at 100% CPU or was IO bandwidth your limit? And is the answer the same for all three configurations? Servus Manfred From pgsql-general-owner@postgresql.org Fri Oct 4 09:10:05 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 55179476072 for ; Thu, 3 Oct 2002 12:45:10 -0400 (EDT) Received: from bachata.cybertec.at (unknown [62.116.21.146]) by postgresql.org (Postfix) with SMTP id F3F45475F5F for ; Thu, 3 Oct 2002 12:45:08 -0400 (EDT) Received: (qmail 24137 invoked from network); 3 Oct 2002 16:45:18 -0000 Received: from unknown (HELO cybertec.at) (62.116.21.147) by 62.116.21.146 with SMTP; 3 Oct 2002 16:45:18 -0000 Message-ID: <3D9C7579.2010206@cybertec.at> Date: Thu, 03 Oct 2002 18:51:05 +0200 From: =?ISO-8859-1?Q?Hans-J=FCrgen_Sch=F6nig?= Reply-To: hs@cybertec.at User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: shridhar_daithankar@persistent.co.in, pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [HACKERS] Large databases, performance References: <3D9C8712.9513.9C6521D@localhost> <3D9CBAD7.23509.A908C61@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/195 X-Sequence-Number: 31193 Shridhar Daithankar wrote: >On 3 Oct 2002 at 11:57, Robert Treat wrote: > > > >>NOTE: Setting follow up to the performance list >> >>Funny that the status quo seems to be if you need fast selects on data >>that has few inserts to pick mysql, otherwise if you have a lot of >>inserts and don't need super fast selects go with PostgreSQL; yet your >>data seems to cut directly against this. >> >> > >Well, couple of things.. > >The number of inserts aren't few. it's 5000/sec.required in the field Secondly >I don't know really but postgresql seems doing pretty fine in parallel selects. >If we use mysql with transaction support then numbers are really close.. > >May be it's time to rewrite famous myth that postgresql is slow. When properly >tuned or given enough head room, it's almost as fast as mysql.. > > In the case of concurrent transactions MySQL does not do as well due to very bad locking behavious. PostgreSQL is far better because it does row level locking instead of table locking. If you have many concurrent transactions MySQL performs some sort of "self-denial-of-service". I'd choose PostgreSQL in order to make sure that the database does not block. >>I'm curious, did you happen to run the select tests while also running >>the insert tests? IIRC the older mysql versions have to lock the table >>when doing the insert, so select performance goes in the dumper in that >>scenario, perhaps that's not an issue with 3.23.52? >> >> > >IMO even if it locks tables that shouldn't affect select performance. It would >be fun to watch when we insert multiple chunks of data and fire queries >concurrently. I would be surprised if mysql starts slowing down.. > > In the case of concurrent SELECTs and INSERT/UPDATE/DELETE operations MySQL will slow down for sure. The more concurrent transactions you have the worse MySQL will be. >>It also seems like the vacuum after each insert is unnecessary, unless >>your also deleting/updating data behind it. Perhaps just running an >>ANALYZE on the table would suffice while reducing overhead. >> >> > >I believe that was vacuum analyze only. But still it takes lot of time. Good >thing is it's not blocking.. > >Anyway I don't think such frequent vacuums are going to convince planner to >choose index scan over sequential scan. I am sure it's already convinced.. > > PostgreSQL allows you to improve execution plans by giving the planner a hint. In addition to that: if you need REAL performance and if you are running similar queries consider using SPI. Also: 7.3 will support PREPARE/EXECUTE. If you are running MySQL you will not be able to add features to the database easily. In the case of PostgreSQL you have a broad range of simple interfaces which make many things pretty simple (eg. optimized data types in < 50 lines of C code). PostgreSQL is the database of the future and you can perform a lot of tuning. MySQL is a simple frontend to a filesystem and it is fast as long as you are doing SELECT 1+1 operations. Also: Keep in mind that PostgreSQL has a wonderful core team. MySQL is built on Monty Widenius and the core team = Monty. Also: PostgreSQL = ANSI compilant, MySQL = Monty compliant In the past few years I have seen that there is no database system which can beat PostgreSQL's flexibility and stability. I am familiar with various database systems but believe: PostgreSQL is the best choice. Hans >Regards, > Shridhar > >----------------------------------------------------------- >Shridhar Daithankar >LIMS CPE Team Member, PSPL. >mailto:shridhar_daithankar@persistent.co.in >Phone:- +91-20-5678900 Extn.270 >Fax :- +91-20-5678901 >----------------------------------------------------------- > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > >http://archives.postgresql.org > > -- *Cybertec Geschwinde u Schoenig* Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria Tel: +43/1/913 68 09; +43/664/233 90 75 www.postgresql.at , cluster.postgresql.at , www.cybertec.at , kernel.cybertec.at From pgsql-general-owner@postgresql.org Thu Oct 3 12:51:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3CB38476265 for ; Thu, 3 Oct 2002 12:51:08 -0400 (EDT) Received: from email04.aon.at (WARSL402PIP5.highway.telekom.at [195.3.96.79]) by postgresql.org (Postfix) with SMTP id C833D4761D7 for ; Thu, 3 Oct 2002 12:51:06 -0400 (EDT) Received: (qmail 364996 invoked from network); 3 Oct 2002 16:51:12 -0000 Received: from m165p020.dipool.highway.telekom.at (HELO cantor) ([62.46.10.148]) (envelope-sender ) by qmail5rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 3 Oct 2002 16:51:12 -0000 From: Manfred Koizar To: shridhar_daithankar@persistent.co.in Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org, pgsql-general , "pankaj M. Tolani" Subject: Re: [HACKERS] Large databases, performance Date: Thu, 03 Oct 2002 18:53:32 +0200 Message-ID: References: <3D9C8712.9513.9C6521D@localhost> <1033660649.21324.53.camel@camel> <3D9CBAD7.23509.A908C61@localhost> In-Reply-To: <3D9CBAD7.23509.A908C61@localhost> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/142 X-Sequence-Number: 31141 On Thu, 03 Oct 2002 21:47:03 +0530, "Shridhar Daithankar" wrote: >I believe that was vacuum analyze only. Well there is VACUUM [tablename]; and there is ANALYZE [tablename]; And VACUUM ANALYZE [tablename]; is VACUUM followed by ANALYZE. Servus Manfred From pgsql-performance-owner@postgresql.org Thu Oct 3 12:52:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DEE8B4768CD for ; Thu, 3 Oct 2002 12:52:30 -0400 (EDT) Received: from bachata.cybertec.at (unknown [62.116.21.146]) by postgresql.org (Postfix) with SMTP id F3AAE4768C4 for ; Thu, 3 Oct 2002 12:52:29 -0400 (EDT) Received: (qmail 24627 invoked from network); 3 Oct 2002 16:52:39 -0000 Received: from unknown (HELO cybertec.at) (62.116.21.147) by 62.116.21.146 with SMTP; 3 Oct 2002 16:52:39 -0000 Message-ID: <3D9C7732.9080306@cybertec.at> Date: Thu, 03 Oct 2002 18:58:26 +0200 From: =?ISO-8859-1?Q?Hans-J=FCrgen_Sch=F6nig?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: unsubscribe Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/13 X-Sequence-Number: 30 unsubscribe -- *Cybertec Geschwinde u Schoenig* Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria Tel: +43/1/913 68 09; +43/664/233 90 75 www.postgresql.at , cluster.postgresql.at , www.cybertec.at , kernel.cybertec.at From pgsql-performance-owner@postgresql.org Thu Oct 3 13:41:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4F95847648F for ; Thu, 3 Oct 2002 13:40:59 -0400 (EDT) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by postgresql.org (Postfix) with ESMTP id 93BB0476482 for ; Thu, 3 Oct 2002 13:40:58 -0400 (EDT) Received: from localhost.localdomain ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021003174059.OZMW1315.lakemtao04.cox.net@localhost.localdomain> for ; Thu, 3 Oct 2002 13:40:59 -0400 Subject: Re: Large databases, performance From: Ron Johnson To: pgsql-performance@postgresql.org In-Reply-To: <3D9CBAD7.23509.A908C61@localhost> References: <3D9C8712.9513.9C6521D@localhost> <3D9CBAD7.23509.A908C61@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 03 Oct 2002 12:38:49 -0500 Message-Id: <1033666730.28946.64.camel@haggis> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/14 X-Sequence-Number: 31 On Thu, 2002-10-03 at 11:17, Shridhar Daithankar wrote: > On 3 Oct 2002 at 11:57, Robert Treat wrote: > [snip] > > I'm curious, did you happen to run the select tests while also running > > the insert tests? IIRC the older mysql versions have to lock the table > > when doing the insert, so select performance goes in the dumper in that > > scenario, perhaps that's not an issue with 3.23.52? > > IMO even if it locks tables that shouldn't affect select performance. It would > be fun to watch when we insert multiple chunks of data and fire queries > concurrently. I would be surprised if mysql starts slowing down.. What kind of lock? Shared lock or exclusive lock? If SELECT performance tanked when doing simultaneous INSERTs, then maybe there were exclusive table locks. -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "What other evidence do you have that they are terrorists, | | other than that they trained in these camps?" | | 17-Sep-2002 Katie Couric to an FBI agent regarding the 5 | | men arrested near Buffalo NY | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Oct 3 16:57:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 48CBB475AA1 for ; Thu, 3 Oct 2002 16:57:44 -0400 (EDT) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by postgresql.org (Postfix) with ESMTP id A063C475A09 for ; Thu, 3 Oct 2002 16:57:43 -0400 (EDT) Received: from localhost.localdomain ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021003205743.MIEH12192.lakemtao02.cox.net@localhost.localdomain> for ; Thu, 3 Oct 2002 16:57:43 -0400 Subject: Re: [HACKERS] Large databases, performance From: Ron Johnson To: pgsql-performance@postgresql.org In-Reply-To: <3D9C7579.2010206@cybertec.at> References: <3D9C8712.9513.9C6521D@localhost> <3D9CBAD7.23509.A908C61@localhost> <3D9C7579.2010206@cybertec.at> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailer: Ximian Evolution 1.0.8 Date: 03 Oct 2002 15:55:35 -0500 Message-Id: <1033678535.28946.158.camel@haggis> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/15 X-Sequence-Number: 32 On Thu, 2002-10-03 at 11:51, Hans-J=FCrgen Sch=F6nig wrote: > Shridhar Daithankar wrote: >=20 > >On 3 Oct 2002 at 11:57, Robert Treat wrote: [snip] > PostgreSQL allows you to improve execution plans by giving the planner a= =20 > hint. > In addition to that: if you need REAL performance and if you are running= =20 > similar queries consider using SPI. What is SPI? --=20 +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "What other evidence do you have that they are terrorists, | | other than that they trained in these camps?" | | 17-Sep-2002 Katie Couric to an FBI agent regarding the 5 | | men arrested near Buffalo NY | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Oct 3 17:09:21 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9ED65476187 for ; Thu, 3 Oct 2002 17:09:19 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id C485647616D for ; Thu, 3 Oct 2002 17:09:18 -0400 (EDT) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 17xDDk-0001Ue-00 for ; Thu, 03 Oct 2002 17:09:20 -0400 Date: Thu, 3 Oct 2002 17:09:20 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: [HACKERS] Large databases, performance Message-ID: <20021003170920.X18497@mail.libertyrms.com> Reply-To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org References: <3D9C8712.9513.9C6521D@localhost> <3D9CBAD7.23509.A908C61@localhost> <3D9C7579.2010206@cybertec.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3D9C7579.2010206@cybertec.at>; from postgres@cybertec.at on Thu, Oct 03, 2002 at 06:51:05PM +0200 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/17 X-Sequence-Number: 34 On Thu, Oct 03, 2002 at 06:51:05PM +0200, Hans-J?rgen Sch?nig wrote: > In the case of concurrent transactions MySQL does not do as well due to > very bad locking behavious. PostgreSQL is far better because it does row > level locking instead of table locking. It is my understanding that MySQL no longer does this on InnoDB tables. Whether various bag-on-the-side table types are a good thing I will leave to others; but there's no reason to go 'round making claims about old versions of MySQL any more than there is a reason to continue to talk about PostgreSQL not being crash safe. MySQL has moved along nearly as quickly as PostgreSQL. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Thu Oct 3 17:02:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 98D55476265 for ; Thu, 3 Oct 2002 17:02:36 -0400 (EDT) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id E0E64476264 for ; Thu, 3 Oct 2002 17:02:35 -0400 (EDT) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id RAA18011 for ; Thu, 3 Oct 2002 17:02:37 -0400 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma018009; Thu, 3 Oct 02 17:02:31 -0400 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id RAA22887 for ; Thu, 3 Oct 2002 17:02:13 -0400 Message-ID: <3D9CB2A2.47A4F6F1@nsd.ca> Date: Thu, 03 Oct 2002 17:12:02 -0400 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: use [PERF] instead of References: <3D9C8712.9513.9C6521D@localhost> <3D9CBAD7.23509.A908C61@localhost> <3D9C7579.2010206@cybertec.at> <1033678535.28946.158.camel@haggis> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by reddog.nsd.ca id RAA22887 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/16 X-Sequence-Number: 33 May I suggest that instead of [pgsql-performance] that [PERF] be used to save some of the subject line. Ron Johnson wrote: >=20 > On Thu, 2002-10-03 at 11:51, Hans-J=FCrgen Sch=F6nig wrote: > > Shridhar Daithankar wrote: > > > > >On 3 Oct 2002 at 11:57, Robert Treat wrote: > [snip] > > PostgreSQL allows you to improve execution plans by giving the planner a > > hint. > > In addition to that: if you need REAL performance and if you are running > > similar queries consider using SPI. >=20 > What is SPI? >=20 > -- > +------------------------------------------------------------+ > | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | > | Jefferson, LA USA http://members.cox.net/ron.l.johnson | > | | > | "What other evidence do you have that they are terrorists, | > | other than that they trained in these camps?" | > | 17-Sep-2002 Katie Couric to an FBI agent regarding the 5 | > | men arrested near Buffalo NY | > +------------------------------------------------------------+ >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) From pgsql-hackers-owner@postgresql.org Thu Oct 3 19:09:58 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 89E1D476450 for ; Thu, 3 Oct 2002 19:09:56 -0400 (EDT) Received: from slammer.netnation.com (slammer.netnation.com [204.174.223.62]) by postgresql.org (Postfix) with ESMTP id 540244762E0 for ; Thu, 3 Oct 2002 19:09:54 -0400 (EDT) Received: from [10.10.10.11] (helo=mikeb.staff.netnation.com) by slammer.netnation.com with esmtp (Exim 3.36 #1) id 17xF6S-0004uw-00 for pgsql-hackers@postgreSQL.org; Thu, 03 Oct 2002 16:09:56 -0700 Subject: Re: [GENERAL] Performance while loading data and indexing From: Mike Benoit To: pgsql-hackers@postgreSQL.org In-Reply-To: References: <200209262141.g8QLfMr09064@candle.pha.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8-3mdk Date: 03 Oct 2002 16:09:56 -0700 Message-Id: <1033686597.31473.125.camel@mikeb.staff.netnation.com> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/178 X-Sequence-Number: 29947 Some of you may be interested in this seemingly exhaustive benchmark between ext2/3, ReiserFS, JFS, and XFS. http://www.osdl.org/presentations/lwe-jgfs.pdf From pgsql-hackers-owner@postgresql.org Thu Oct 3 19:35:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 06F03475AA1 for ; Thu, 3 Oct 2002 19:35:51 -0400 (EDT) Received: from CopelandConsulting.Net (dsl-24293-ld.customer.centurytel.net [209.142.135.135]) by postgresql.org (Postfix) with ESMTP id 90432475F6A for ; Thu, 3 Oct 2002 19:35:40 -0400 (EDT) Received: from mouse.copelandconsulting.net (mouse.copelandconsulting.net [192.168.1.2]) by CopelandConsulting.Net (8.10.1/8.10.1) with ESMTP id g93NZPd17537; Thu, 3 Oct 2002 18:35:26 -0500 (CDT) X-Trade-Id: To: Mike Benoit Cc: PostgresSQL Hackers Mailing List In-Reply-To: <1033686597.31473.125.camel@mikeb.staff.netnation.com> References: <200209262141.g8QLfMr09064@candle.pha.pa.us> <1033686597.31473.125.camel@mikeb.staff.netnation.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-BuYK0VVffYM+zNI+A4b0" X-Mailer: Ximian Evolution 1.0.8 Date: 03 Oct 2002 18:35:34 -0500 Message-Id: <1033688135.13005.28.camel@mouse.copelandconsulting.net> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/180 X-Sequence-Number: 29949 --=-BuYK0VVffYM+zNI+A4b0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hey, excellent. Thanks! Based on that, it appears that XFS is a pretty good FS to use. For me, the real surprise was how well reiserfs performed. Greg On Thu, 2002-10-03 at 18:09, Mike Benoit wrote: > Some of you may be interested in this seemingly exhaustive benchmark > between ext2/3, ReiserFS, JFS, and XFS. >=20 > http://www.osdl.org/presentations/lwe-jgfs.pdf >=20 >=20 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? >=20 > http://archives.postgresql.org --=-BuYK0VVffYM+zNI+A4b0 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) iD8DBQA9nNRG4lr1bpbcL6kRAjiYAJsFu0Zzy9SypyS71KkTsIUCu93D+wCfV7Sl pDPuo2tpeJBVZJzbcnN9WDs= =IsJZ -----END PGP SIGNATURE----- --=-BuYK0VVffYM+zNI+A4b0-- From pgsql-hackers-owner@postgresql.org Thu Oct 3 20:01:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 175E947600E for ; Thu, 3 Oct 2002 20:01:31 -0400 (EDT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id B5F71475B84 for ; Thu, 3 Oct 2002 20:01:18 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g93NxuZ07976; Thu, 3 Oct 2002 19:59:56 -0400 (EDT) From: Bruce Momjian Message-Id: <200210032359.g93NxuZ07976@candle.pha.pa.us> Subject: Re: [GENERAL] Performance while loading data and indexing In-Reply-To: <1033688135.13005.28.camel@mouse.copelandconsulting.net> To: Greg Copeland Date: Thu, 3 Oct 2002 19:59:56 -0400 (EDT) Cc: Mike Benoit , PostgresSQL Hackers Mailing List X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/184 X-Sequence-Number: 29953 Greg Copeland wrote: -- Start of PGP signed section. > Hey, excellent. Thanks! > > Based on that, it appears that XFS is a pretty good FS to use. For me, > the real surprise was how well reiserfs performed. > OK, hardware performance paper updated: --------------------------------------------------------------------------- File system choice is particularly difficult on Linux because there are so many file system choices, and none of them are optimal: ext2 is not entirely crash-safe, ext3, xfs, and jfs are journal-based, and Reiser is optimized for small files and does journalling. The journalling file systems can be significantly slower than ext2 but when crash recovery is required, ext2 isn't an option. If ext2 must be used, mount it with sync enabled. Some people recommend xfs or an ext3 filesystem mounted with data=writeback. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-general-owner@postgresql.org Fri Oct 4 04:00:33 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 88451476148 for ; Fri, 4 Oct 2002 04:00:26 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id D1A59476082 for ; Fri, 4 Oct 2002 04:00:24 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g9481rO29203 for ; Fri, 4 Oct 2002 13:31:53 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g9481rv29188; Fri, 4 Oct 2002 13:31:53 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org, pgsql-general , "pankaj M. Tolani" Date: Fri, 04 Oct 2002 13:30:54 +0530 MIME-Version: 1.0 Subject: Re: [HACKERS] Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3D9D980E.30447.102C03@localhost> In-reply-to: References: <3D9CBAD7.23509.A908C61@localhost> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/173 X-Sequence-Number: 31172 On 3 Oct 2002 at 18:53, Manfred Koizar wrote: > On Thu, 03 Oct 2002 21:47:03 +0530, "Shridhar Daithankar" > wrote: > >I believe that was vacuum analyze only. > > Well there is > > VACUUM [tablename]; > > and there is > > ANALYZE [tablename]; > > And > > VACUUM ANALYZE [tablename]; > > is VACUUM followed by ANALYZE. I was using vacuum analyze. Good that you pointed out. Now I will modify the postgresql auto vacuum daemon that I wrote to analyze only in case of excesive inserts. I hope that's lighter on performance compared to vacuum analyze.. Bye Shridhar -- Mix's Law: There is nothing more permanent than a temporary building. There is nothing more permanent than a temporary tax. From pgsql-performance-owner@postgresql.org Fri Oct 4 12:04:21 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 924624773CF for ; Fri, 4 Oct 2002 11:58:00 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 9887F477259 for ; Fri, 4 Oct 2002 11:56:41 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1771475; Fri, 04 Oct 2002 08:54:56 -0700 From: "Josh Berkus" Subject: Re: Comparitive UPDATE speed To: Ron Johnson Cc: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Fri, 04 Oct 2002 08:54:56 -0700 Message-ID: In-Reply-To: <1033708425.28946.203.camel@haggis> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/19 X-Sequence-Number: 36 Folks, Sorry for the double-quoting here. I sent this to just Ron by accident. My original question is double-quoted, Ron is quoted, and my responses are below. Thanks! > > Ok, I'm still confused. > > > > I'm updating a (not not indexed) field in a 117,000 row table based > on > > information in another 117,000 row table. The update is an > integer, and the > > linking fields are indexed. Yet the two queries are flattening my > > > dual-processor, RAID5 database server for up to 11 minutes ... > using 230mb > > ram the entire time. I simply can't believe that these two > queries are that > > difficult. > > So there's no index on elbs_matter_links.case_id? From your original > > post, I thought that there *is* an index on that field. I'm now dropping it before the update. Unfortunately, dropping the index made no appreciable gain in performance. > > I've increased the memory available to the update to 256mb, and > tried forcing > > an index scan ... to no avail. Ideas, please? > > > > The queries: > > > > UPDATE elbs_matter_links SET case_id = case_clients.case_id > > FROM case_clients > > WHERE elbs_matter_links.mmatter = case_clients.matter_no; > > What happens if you run the query: > SELECT eml.case_id, cc.case_id, eml.mmatter, cc.matter_no > FROM elbs_matter_links eml, > case_clients cc > WHERE eml.mmatter = cc.matter_no; > > That, for all intents and purposes, is your UPDATE statement, just > without doing the UPDATE. How fast does it run? Slowly. It takes about 60 seconds to return data. This may be the problem. Thoughts? Here's EXPLAIN output: Hash Join (cost=3076.10..91842.88 rows=108648 width=40) -> Seq Scan on elbs_matter_links eml (cost=0.00..85641.87 rows=117787 width=20) -> Hash (cost=2804.48..2804.48 rows=108648 width=20) -> Seq Scan on case_clients cc (cost=0.00..2804.48 rows=108648 width=20) According to the parser, using the indexes would be worse: Merge Join (cost=0.00..520624.38 rows=108648 width=40) -> Index Scan using idx_eml_mmatter on elbs_matter_links eml (cost=0.00..451735.00 rows=117787 width=20) -> Index Scan using idx_caseclients_matter on case_clients cc (cost=0.00..66965.20 rows=108648 width=20) Though in practice, a forced index scan returns rows in about 60 seconds, same as the SeqScan version. All of this seems very costly for a query that, while it does return a lot of rows, is essentially a very simple query. More importantly, on the hardware I'm using, I would expect better performance that I get on my laptop ... and I'm not seeing it. I just can't believe that the simple query above could soak 200mb of RAM for a full 60 seconds to return a result. It's like queries over a certain result size on the system choke postgres. My reference data below: ============================================== > > > UPDATE elbs_matter_links SET case_id = cases.case_id > > FROM cases > > WHERE elbs_matter_links.docket = cases.docket > > AND elbs_matter_links.case_id IS NULL; > > > > > > EXPLAIN output: > > > > Hash Join (cost=4204.83..39106.77 rows=8473 width=299) > > -> Index Scan using idx_eml_mmatter on elbs_matter_links > > (cost=0.00..34668.94 rows=8473 width=279) > > -> Hash (cost=2808.38..2808.38 rows=109038 width=20) > > -> Seq Scan on case_clients (cost=0.00..2808.38 > rows=109038 > > width=20) > > > > Nested Loop (cost=0.00..32338.47 rows=99 width=300) > > -> Seq Scan on cases (cost=0.00..9461.97 rows=4297 width=21) > > -> Index Scan using idx_eml_docket on elbs_matter_links > (cost=0.00..5.31 > > rows=1 width=279) > > > > Table defintions: > > > > Table "elbs_matter_links" > > Column | Type | Modifiers > > ------------------+-----------------------+----------------------- > > mmatter | character varying(15) | not null > > case_id | integer | > > matter_check | character varying(20) | not null default 'OK' > > docket | character varying(50) | > > case_name | character varying(50) | > > practice | character varying(50) | > > opp_counsel_name | character varying(50) | > > opp_counsel_id | integer | > > act_type | character varying(10) | > > lead_case_id | integer | > > lead_case_docket | character varying(50) | > > disease | character varying(50) | > > docket_no | character varying(25) | > > juris_state | character varying(6) | > > juris_local | character varying(20) | > > status | smallint | not null default 1 > > client_id | integer | > > office_loc | character varying(5) | > > date_filed | date | > > date_served | date | > > date_resolved | date | > > case_status | character varying(5) | > > settle_amount | numeric(12,2) | default 0 > > narrative | text | > > comment | character varying(50) | > > client_no | character varying(10) | > > juris_id | integer | > > Indexes: idx_eml_check, > > idx_eml_docket, > > idx_eml_mmatter > > Primary key: elbs_matter_links_pkey > > > > Table "case_clients" > > Column | Type | > Modifiers > > > ------------------+-----------------------+---------------------------------------------------- > > case_client_id | integer | not null default > > nextval('case_clients_seq'::text) > > case_id | integer | not null > > client_id | integer | not null > > office_loc | character varying(5) | > > date_filed | date | > > date_served | date | > > date_resolved | date | > > matter_no | character varying(15) | not null > > case_status | character varying(5) | not null > > settle_amount | numeric(14,2) | not null default 0 > > matter_narrative | text | > > comment | character varying(50) | > > Indexes: idx_case_clients_client, > > idx_caseclients_case, > > idx_caseclients_matter, > > idx_caseclients_resolved, > > idx_caseclients_served, > > idx_caseclients_status > > Primary key: case_clients_pkey > > > > > > Table "cases" > > Column | Type | > Modifiers > > > ------------------+-----------------------+--------------------------------------------- > > case_id | integer | not null default > > nextval('cases_seq'::text) > > docket | character varying(50) | not null > > case_name | character varying(50) | not null > > practice | character varying(50) | not null > > opp_counsel_name | character varying(50) | > > opp_counsel_id | integer | > > act_type | character varying(10) | > > lead_case_id | integer | > > lead_case_docket | character varying(50) | > > disease | character varying(50) | > > docket_no | character varying(25) | not null > > juris_state | character varying(6) | not null > > juris_local | character varying(20) | > > tgroup_id | integer | > > status | smallint | not null default 1 > > juris_id | integer | > > Indexes: idx_case_cases_juris, > > idx_cases_docket, > > idx_cases_lead, > > idx_cases_name, > > idx_cases_status, > > idx_cases_tgroup, > > idx_lower_case_name > > > > > > > > -- > > Josh Berkus > > josh@agliodbs.com > > Aglio Database Solutions > > San Francisco > -- > +------------------------------------------------------------+ > | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | > | Jefferson, LA USA http://members.cox.net/ron.l.johnson | > | | > | "What other evidence do you have that they are terrorists, | > | other than that they trained in these camps?" | > | 17-Sep-2002 Katie Couric to an FBI agent regarding the 5 | > | men arrested near Buffalo NY | > +------------------------------------------------------------+ > ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-general-owner@postgresql.org Fri Oct 4 12:17:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 38FDD47590C; Fri, 4 Oct 2002 12:15:54 -0400 (EDT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id B3CA34771AE; Fri, 4 Oct 2002 12:13:54 -0400 (EDT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id g94GD0S5008804; Fri, 4 Oct 2002 10:13:00 -0600 (MDT) Date: Fri, 4 Oct 2002 10:05:10 -0600 (MDT) From: "scott.marlowe" To: Cc: , , Subject: Re: [HACKERS] Large databases, performance In-Reply-To: <3D9C7579.2010206@cybertec.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/258 X-Sequence-Number: 31256 On Thu, 3 Oct 2002, Hans-J�rgen Sch�nig wrote: > In the case of concurrent transactions MySQL does not do as well due to > very bad locking behavious. PostgreSQL is far better because it does row > level locking instead of table locking. > If you have many concurrent transactions MySQL performs some sort of > "self-denial-of-service". I'd choose PostgreSQL in order to make sure > that the database does not block. While I'm no big fan of MySQL, I must point out that with innodb tables, the locking is row level, and the ability to handle parallel read / write is much improved. Also, Postgresql does NOT use row level locking, it uses MVCC, which is "better than row level locking" as Tom puts it. Of course, hot backup is only 2,000 Euros for an innodb table mysql, while hot backup for postgresql is free. :-) That said, MySQL still doesn't handle parallel load nearly as well as postgresql, it's just better than it once was. > Also: Keep in mind that PostgreSQL has a wonderful core team. MySQL is > built on Monty Widenius and the core team = Monty. > Also: PostgreSQL = ANSI compilant, MySQL = Monty compliant This is a very valid point. The "committee" that creates and steers Postgresql is very much a meritocracy. The "committee" that steers MySQL is Monty. I'm much happier knowing that every time something important needs to be done we have a whole cupboard full of curmudgeons arguing the fine points so that the "right thing" gets done. From pgsql-general-owner@postgresql.org Mon Oct 7 08:37:33 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 538C347705B for ; Fri, 4 Oct 2002 12:25:17 -0400 (EDT) Received: from bachata.cybertec.at (unknown [62.116.21.146]) by postgresql.org (Postfix) with SMTP id 4A073476920 for ; Fri, 4 Oct 2002 12:24:58 -0400 (EDT) Received: (qmail 15316 invoked from network); 4 Oct 2002 16:24:51 -0000 Received: from unknown (HELO cybertec.at) (62.116.21.147) by 62.116.21.146 with SMTP; 4 Oct 2002 16:24:51 -0000 Message-ID: <3D9DC237.8060802@cybertec.at> Date: Fri, 04 Oct 2002 18:30:47 +0200 From: =?ISO-8859-1?Q?Hans-J=FCrgen_Sch=F6nig?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "scott.marlowe" , pgsql-general@postgresql.org Subject: Re: [HACKERS] Large databases, performance References: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/363 X-Sequence-Number: 31361 MVCC = great ... I know that is not row level locking but that's the way things can be explained more easily. Many people are asking my how things work and this way it is easier to understand. Never tell a trainee about deadlock detection and co *g*. I am happy that the PostgreSQL core team + all developers are not like Monty ... I am happy to PostgreSQL has developers such as Bruce, Tom, Jan, Marc, Vadim, Joe, Neil, Christopher, etc. (just to name a few) ... Yes, it is said to be better than it was but that's not the point: MySQL = Monty SQL <> ANSI SQL ... Believe me, the table will turn and finally the better system will succeed. One we have clustering, PITR, etc. running people will see how real databases work :). Hans scott.marlowe wrote: >On Thu, 3 Oct 2002, Hans-J�rgen Sch�nig wrote: > > > >>In the case of concurrent transactions MySQL does not do as well due to >>very bad locking behavious. PostgreSQL is far better because it does row >>level locking instead of table locking. >>If you have many concurrent transactions MySQL performs some sort of >>"self-denial-of-service". I'd choose PostgreSQL in order to make sure >>that the database does not block. >> >> > >While I'm no big fan of MySQL, I must point out that with innodb tables, >the locking is row level, and the ability to handle parallel read / write >is much improved. > >Also, Postgresql does NOT use row level locking, it uses MVCC, which is >"better than row level locking" as Tom puts it. > >Of course, hot backup is only 2,000 Euros for an innodb table mysql, while >hot backup for postgresql is free. :-) > >That said, MySQL still doesn't handle parallel load nearly as well as >postgresql, it's just better than it once was. > > > >>Also: Keep in mind that PostgreSQL has a wonderful core team. MySQL is >>built on Monty Widenius and the core team = Monty. >>Also: PostgreSQL = ANSI compilant, MySQL = Monty compliant >> >> > >This is a very valid point. The "committee" that creates and steers >Postgresql is very much a meritocracy. The "committee" that steers MySQL >is Monty. > >I'm much happier knowing that every time something important needs to be >done we have a whole cupboard full of curmudgeons arguing the fine points >so that the "right thing" gets done. > > -- *Cybertec Geschwinde u Schoenig* Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria Tel: +43/1/913 68 09; +43/664/233 90 75 www.postgresql.at , cluster.postgresql.at , www.cybertec.at , kernel.cybertec.at From pgsql-performance-owner@postgresql.org Fri Oct 4 12:36:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6CE56476920 for ; Fri, 4 Oct 2002 12:36:01 -0400 (EDT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 328704768CD for ; Fri, 4 Oct 2002 12:36:00 -0400 (EDT) Received: (qmail 18434 invoked by uid 0); 4 Oct 2002 16:36:05 -0000 Received: from chello062178186201.1.15.tuwien.teleweb.at (HELO beeblebrox) (62.178.186.201) by mail.gmx.net (mp016-rz3) with SMTP; 4 Oct 2002 16:36:05 -0000 Message-ID: <01c601c26bc4$73d5f900$4201a8c0@beeblebrox> From: "Michael Paesold" To: References: <3D9C8712.9513.9C6521D@localhost> <3D9CBAD7.23509.A908C61@localhost> <3D9C7579.2010206@cybertec.at> <20021003170920.X18497@mail.libertyrms.com> Subject: Re: Large databases, performance Date: Fri, 4 Oct 2002 18:38:21 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/21 X-Sequence-Number: 38 Andrew Sullivan wrote: > On Thu, Oct 03, 2002 at 06:51:05PM +0200, Hans-J?rgen Sch?nig wrote: > > > In the case of concurrent transactions MySQL does not do as well due to > > very bad locking behavious. PostgreSQL is far better because it does row > > level locking instead of table locking. > > It is my understanding that MySQL no longer does this on InnoDB > tables. Whether various bag-on-the-side table types are a good thing > I will leave to others; but there's no reason to go 'round making > claims about old versions of MySQL any more than there is a reason to > continue to talk about PostgreSQL not being crash safe. MySQL has > moved along nearly as quickly as PostgreSQL. Locking and transactions is not fine in MySQL (with InnoDB) though. I tried to do selects on a table I was concurrently inserting to. In a single thread I was constantly inserting 1000 rows per transaction. While inserting I did some random selects on the same table. It often happend that the insert transactions were aborted due to dead lock problems. There I see the problem with locking reads. I like PostgreSQL's MVCC! Regards, Michael Paesold From pgsql-performance-owner@postgresql.org Fri Oct 4 12:44:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AC7E547635A for ; Fri, 4 Oct 2002 12:44:00 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 237B6476237 for ; Fri, 4 Oct 2002 12:43:59 -0400 (EDT) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 17xVYZ-0003cy-00 for ; Fri, 04 Oct 2002 12:44:03 -0400 Date: Fri, 4 Oct 2002 12:44:03 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Comparitive UPDATE speed Message-ID: <20021004124403.I949@mail.libertyrms.com> Mail-Followup-To: pgsql-performance@postgresql.org References: <1033708425.28946.203.camel@haggis> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from josh@agliodbs.com on Fri, Oct 04, 2002 at 08:54:56AM -0700 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/22 X-Sequence-Number: 39 On Fri, Oct 04, 2002 at 08:54:56AM -0700, Josh Berkus wrote: > Slowly. It takes about 60 seconds to return data. This may be the > problem. Thoughts? Here's EXPLAIN output: [. . .] > According to the parser, using the indexes would be worse: Have you run this with EXPLAIN ANALYSE? It will actually perform the necessary steps, so it will reveal if the planner is getting something wrong. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-general-owner@postgresql.org Fri Oct 4 12:47:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 219A5476C36 for ; Fri, 4 Oct 2002 12:47:39 -0400 (EDT) Received: from scanmail4.cableone.net (scanmail4.cableone.net [24.116.0.124]) by postgresql.org (Postfix) with ESMTP id 14C33476B49 for ; Fri, 4 Oct 2002 12:47:38 -0400 (EDT) Received: from scanmail4.cableone.net ([10.116.0.124]) by scanmail4.cableone.net with Microsoft SMTPSVC(5.5.1877.687.68); Fri, 4 Oct 2002 09:46:44 -0700 Received: from scanmail4.cableone.net [24.116.0.124] by scanmail4.cableone.net (SMTPD32-7.04) id A5D390246; Fri, 04 Oct 2002 09:46:14 -0700 Received: from redwood ( [24.117.24.47]) by mail.cableone.net with SMTP (MailShield v2.04 - WIN32 Jul 17 2001 17:12:42); Fri, 04 Oct 2002 09:46:13 -0600 From: "David Blood" To: Subject: Pinning a table into memory Date: Fri, 4 Oct 2002 10:46:57 -0600 Message-ID: <03a301c26bc5$a799a970$1f00a8c0@redwood> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 In-Reply-To: <01c601c26bc4$73d5f900$4201a8c0@beeblebrox> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SMTP-HELO: redwood X-SMTP-MAIL-FROM: david@matraex.com X-SMTP-PEER-INFO: [24.117.24.47] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/263 X-Sequence-Number: 31261 In Oracle you can Pin large objects into memory to prevent frequent reloads. Is there anyway to do this with Postgres? It appears that some of our tables that get hit a lot may get kicked out of memory when we access some of our huge tables. Then they have to wait for I/O to get loaded back in. David Blood Matraex, Inc From pgsql-performance-owner@postgresql.org Fri Oct 4 14:14:35 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5CDC647627D for ; Fri, 4 Oct 2002 14:14:33 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 8C29147620C for ; Fri, 4 Oct 2002 14:14:32 -0400 (EDT) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1771672; Fri, 04 Oct 2002 11:12:28 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: Comparitive UPDATE speed Date: Fri, 4 Oct 2002 11:13:09 -0700 X-Mailer: KMail [version 1.4] References: <1033708425.28946.203.camel@haggis> <20021004124403.I949@mail.libertyrms.com> In-Reply-To: <20021004124403.I949@mail.libertyrms.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210041113.10008.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/23 X-Sequence-Number: 40 Andrew, > Have you run this with EXPLAIN ANALYSE? It will actually perform the > necessary steps, so it will reveal if the planner is getting > something wrong. Here it is: Hash Join (cost=3D3076.10..91842.88 rows=3D108648 width=3D40) (actual=20 time=3D18625.19..22823.39 rows=3D108546 loops=3D1) -> Seq Scan on elbs_matter_links eml (cost=3D0.00..85641.87 rows=3D1177= 87=20 width=3D20) (actual time=3D18007.69..19515.63 rows=3D117787 loops=3D1) -> Hash (cost=3D2804.48..2804.48 rows=3D108648 width=3D20) (actual=20 time=3D602.12..602.12 rows=3D0 loops=3D1) -> Seq Scan on case_clients cc (cost=3D0.00..2804.48 rows=3D10864= 8=20 width=3D20) (actual time=3D5.18..370.68 rows=3D108648 loops=3D1) Total runtime: 22879.26 msec The above doesn't seem bad, except that this is some serious hardware in th= is=20 system and 23 seconds right after VACUUM ANALYZE is too long. I've a feeli= ng=20 that I botched one of my postgresql.conf parameters or something. I'll do an explain for the UPDATE query later, when the users are off the= =20 system. -Josh Berkus --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Oct 4 14:25:29 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F25084766A2 for ; Fri, 4 Oct 2002 14:25:27 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 1CD304762E0 for ; Fri, 4 Oct 2002 14:25:24 -0400 (EDT) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 17xX8d-0005Wv-00 for ; Fri, 04 Oct 2002 14:25:23 -0400 Date: Fri, 4 Oct 2002 14:25:23 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Comparitive UPDATE speed Message-ID: <20021004142523.M949@mail.libertyrms.com> Mail-Followup-To: pgsql-performance@postgresql.org References: <1033708425.28946.203.camel@haggis> <20021004124403.I949@mail.libertyrms.com> <200210041113.10008.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200210041113.10008.josh@agliodbs.com>; from josh@agliodbs.com on Fri, Oct 04, 2002 at 11:13:09AM -0700 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/24 X-Sequence-Number: 41 On Fri, Oct 04, 2002 at 11:13:09AM -0700, Josh Berkus wrote: > > Andrew, > > > Have you run this with EXPLAIN ANALYSE? It will actually perform the > > necessary steps, so it will reveal if the planner is getting > > something wrong. > > Here it is: Oops, sorry. What if you force the index use here? Just because the planner thinks that's more expensive doesn't mean that it is. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-general-owner@postgresql.org Fri Oct 4 14:47:50 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D51644762E0 for ; Fri, 4 Oct 2002 14:47:49 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 1D4394762E2 for ; Fri, 4 Oct 2002 14:47:49 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g94IllhR025546; Fri, 4 Oct 2002 14:47:48 -0400 (EDT) To: "David Blood" Cc: pgsql-general@postgresql.org Subject: Re: Pinning a table into memory In-reply-to: <03a301c26bc5$a799a970$1f00a8c0@redwood> References: <03a301c26bc5$a799a970$1f00a8c0@redwood> Comments: In-reply-to "David Blood" message dated "Fri, 04 Oct 2002 10:46:57 -0600" Date: Fri, 04 Oct 2002 14:47:47 -0400 Message-ID: <25545.1033757267@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/274 X-Sequence-Number: 31272 "David Blood" writes: > In Oracle you can Pin large objects into memory to prevent frequent > reloads. Is there anyway to do this with Postgres? I can never understand why people think this would be a good idea. If you're hitting a table frequently, it will stay in memory anyway (either in Postgres shared buffers or kernel disk cache). If you're not hitting it frequently enough to keep it swapped in, then whatever is getting swapped in instead is probably a better candidate to be occupying the space. ISTM that a manual "pin this table" knob would mostly have the effect of making performance worse, whenever the system activity is slightly different from the situation you had in mind when you installed the pin. Having said that, I'll freely concede that our cache management algorithms could use improvement (and there are people looking at that right now). But a manual pin doesn't seem like a better answer. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Oct 4 15:10:49 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4835B47610A for ; Fri, 4 Oct 2002 15:10:48 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id A5D4B4760DB for ; Fri, 4 Oct 2002 15:10:47 -0400 (EDT) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1771773; Fri, 04 Oct 2002 12:09:01 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: Comparitive UPDATE speed Date: Fri, 4 Oct 2002 12:09:42 -0700 X-Mailer: KMail [version 1.4] References: <1033708425.28946.203.camel@haggis> <200210041113.10008.josh@agliodbs.com> <20021004142523.M949@mail.libertyrms.com> In-Reply-To: <20021004142523.M949@mail.libertyrms.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210041209.42665.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/25 X-Sequence-Number: 42 Andrew, > Oops, sorry. What if you force the index use here? Just because the > planner thinks that's more expensive doesn't mean that it is. Yeah, I tried it ... no faster, no slower, really. BTW, in case you missed it, the real concern is that an UPDATE query simila= r=20 to the SELECT query we are discussing takes over 10 minutes, which on this= =20 hardware is ridiculous. Robert suggested that we test the SELECT query to= =20 see if there were general performance problems; apparently, there are. The hardware I'm using is: dual-processor Athalon 1400mhz motherboard raid 5 UW SCSI drive array with 3 drives 512mb DDR RAM SuSE Linux 7.3 (Kernel 2.4.10) Postgres is on its own LVM partition PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.95.3 (will upgrade to 7.2.3 very soon) Postgresql.conf has: fdatasync, various chared memory tuned to allocate 256= mb=20 to postgres (which seems to be working correctly). Debug level 2. When the UPDATE query takes a long time, I generally can watch the log hove= r=20 in the land of "Reaping dead child processes" for 30-90 seconds per=20 iteration. --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Oct 4 15:24:16 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 90A1D475BA1 for ; Fri, 4 Oct 2002 15:24:15 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id D62FC47580B for ; Fri, 4 Oct 2002 15:24:14 -0400 (EDT) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 17xY3b-0006bh-00 for ; Fri, 04 Oct 2002 15:24:15 -0400 Date: Fri, 4 Oct 2002 15:24:15 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Comparitive UPDATE speed Message-ID: <20021004152415.T949@mail.libertyrms.com> Mail-Followup-To: pgsql-performance@postgresql.org References: <1033708425.28946.203.camel@haggis> <200210041113.10008.josh@agliodbs.com> <20021004142523.M949@mail.libertyrms.com> <200210041209.42665.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200210041209.42665.josh@agliodbs.com>; from josh@agliodbs.com on Fri, Oct 04, 2002 at 12:09:42PM -0700 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/26 X-Sequence-Number: 43 On Fri, Oct 04, 2002 at 12:09:42PM -0700, Josh Berkus wrote: > BTW, in case you missed it, the real concern is that an UPDATE query similar > to the SELECT query we are discussing takes over 10 minutes, which on this > hardware is ridiculous. Robert suggested that we test the SELECT query to > see if there were general performance problems; apparently, there are. Yes, that's my thought, too. > Postgresql.conf has: fdatasync, various chared memory tuned to allocate 256mb > to postgres (which seems to be working correctly). Hmm. Are you swapping? Lots of temp files? (I presume you've been over all that.) Half your physical memory seems pretty dangerous to me. If oyu reduce that, does it help? > When the UPDATE query takes a long time, I generally can watch the log hover > in the land of "Reaping dead child processes" for 30-90 seconds per > iteration. Ick. Hmm. What sort of numbers do you get from vmstat, iostat, sar, and friends? A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Fri Oct 4 15:41:17 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AB43E476094 for ; Fri, 4 Oct 2002 15:41:15 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 11B5E475EE2 for ; Fri, 4 Oct 2002 15:41:15 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g94JfEhR026114; Fri, 4 Oct 2002 15:41:14 -0400 (EDT) To: Josh Berkus Cc: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: Comparitive UPDATE speed In-reply-to: <200210041113.10008.josh@agliodbs.com> References: <1033708425.28946.203.camel@haggis> <20021004124403.I949@mail.libertyrms.com> <200210041113.10008.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 04 Oct 2002 11:13:09 -0700" Date: Fri, 04 Oct 2002 15:41:14 -0400 Message-ID: <26113.1033760474@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/27 X-Sequence-Number: 44 Josh Berkus writes: > Hash Join (cost=3076.10..91842.88 rows=108648 width=40) (actual > time=18625.19..22823.39 rows=108546 loops=1) > -> Seq Scan on elbs_matter_links eml (cost=0.00..85641.87 rows=117787 > width=20) (actual time=18007.69..19515.63 rows=117787 loops=1) > -> Hash (cost=2804.48..2804.48 rows=108648 width=20) (actual > time=602.12..602.12 rows=0 loops=1) > -> Seq Scan on case_clients cc (cost=0.00..2804.48 rows=108648 > width=20) (actual time=5.18..370.68 rows=108648 loops=1) > Total runtime: 22879.26 msec Hm. Why does it take 19500 milliseconds to read 117787 rows from elbs_matter_links, if 108648 rows can be read from case_clients in 370 msec? And why does the output show that the very first of those rows was returned only after 18000 msec? I am suspicious that this table has a huge number of empty pages in it, mostly at the beginning. If so, a VACUUM FULL would help. (Try "vacuum full verbose elbs_matter_links" and see if it indicates it's reclaiming any large number of pages.) If that proves to be the answer, you need to look to your FSM parameters, and perhaps arrange for more frequent regular vacuums of this table. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Oct 4 15:45:35 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A87F1476D3E for ; Fri, 4 Oct 2002 15:45:34 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id D4F64476BFA for ; Fri, 4 Oct 2002 15:45:32 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g94JjShR026160; Fri, 4 Oct 2002 15:45:28 -0400 (EDT) To: Josh Berkus Cc: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: Comparitive UPDATE speed In-reply-to: <200210041209.42665.josh@agliodbs.com> References: <1033708425.28946.203.camel@haggis> <200210041113.10008.josh@agliodbs.com> <20021004142523.M949@mail.libertyrms.com> <200210041209.42665.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 04 Oct 2002 12:09:42 -0700" Date: Fri, 04 Oct 2002 15:45:28 -0400 Message-ID: <26159.1033760728@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/28 X-Sequence-Number: 45 Josh Berkus writes: > When the UPDATE query takes a long time, I generally can watch the log hover > in the land of "Reaping dead child processes" for 30-90 seconds per > iteration. Uh ... would you translate that observation into English please? Or better, provide the log output you're looking at? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Oct 4 17:02:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 022CF47610A for ; Fri, 4 Oct 2002 17:02:12 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 66A6C4760B0 for ; Fri, 4 Oct 2002 17:02:11 -0400 (EDT) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1771959; Fri, 04 Oct 2002 14:00:27 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Tom Lane Subject: Re: Comparitive UPDATE speed Date: Fri, 4 Oct 2002 14:01:07 -0700 X-Mailer: KMail [version 1.4] Cc: Andrew Sullivan , pgsql-performance@postgresql.org References: <1033708425.28946.203.camel@haggis> <200210041113.10008.josh@agliodbs.com> <26113.1033760474@sss.pgh.pa.us> In-Reply-To: <26113.1033760474@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210041401.07878.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/29 X-Sequence-Number: 46 Tom, > I am suspicious that this table has a huge number of empty pages in it, > mostly at the beginning. If so, a VACUUM FULL would help. (Try > "vacuum full verbose elbs_matter_links" and see if it indicates it's > reclaiming any large number of pages.) Thank you. Aha. That appears to have been the main problem; apparently, at some time during= my=20 tinkering, I dumped most of the rows from elbs_matter_links a couple of=20 times. Ooops. I'll post the new situation when I test the update queries tonight. --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco From pgsql-general-owner@postgresql.org Sun Oct 6 11:52:37 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CCE504761E9; Sun, 6 Oct 2002 11:52:35 -0400 (EDT) Received: from platonic.cynic.net (platonic.cynic.net [204.80.150.245]) by postgresql.org (Postfix) with ESMTP id 5ACF1475F8C; Sun, 6 Oct 2002 11:52:35 -0400 (EDT) Received: from angelic.cynic.net (angelic-platonic.cvpn.cynic.net [198.73.220.226]) by platonic.cynic.net (Postfix) with ESMTP id 65E37BF4C; Sun, 6 Oct 2002 15:52:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by angelic.cynic.net (Postfix) with ESMTP id 9557F8736; Mon, 7 Oct 2002 00:52:24 +0900 (JST) Date: Mon, 7 Oct 2002 00:52:24 +0900 (JST) From: Curt Sampson To: Neil Conway Cc: PostgresSQL Hackers Mailing List , PostgresSQL General Mailing List Subject: Re: [HACKERS] Performance while loading data and indexing In-Reply-To: <87n0q4zc0l.fsf@mailbox.samurai.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/324 X-Sequence-Number: 31322 On 26 Sep 2002, Neil Conway wrote: > The fact that ext2 defaults to asynchronous mode and UFS (at least on > the BSDs) defaults to synchronous mode seems like a total non-issue to > me. Is there any more to the alleged difference in reliability? It was sort of pointed out here, but perhaps not made completely clear, that Berkley FFS defaults to synchronous meta-data updates, but asynchronous data updates. You can also specify entirely synchronous or entirely asynchronous updates. Linux ext2fs supports only these last two modes, which is the problem. cjs -- Curt Sampson +81 90 7737 2974 http://www.netbsd.org Don't you know, in this new Dark Age, we're all light. --XTC From pgsql-general-owner@postgresql.org Sun Oct 6 22:27:05 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D2FD7475EE1; Sun, 6 Oct 2002 22:27:03 -0400 (EDT) Received: from platonic.cynic.net (platonic.cynic.net [204.80.150.245]) by postgresql.org (Postfix) with ESMTP id 4E868475E45; Sun, 6 Oct 2002 22:27:03 -0400 (EDT) Received: from angelic.cynic.net (angelic-platonic.cvpn.cynic.net [198.73.220.226]) by platonic.cynic.net (Postfix) with ESMTP id B13B7BF4C; Mon, 7 Oct 2002 02:27:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by angelic.cynic.net (Postfix) with ESMTP id 752128736; Mon, 7 Oct 2002 11:27:04 +0900 (JST) Date: Mon, 7 Oct 2002 11:27:04 +0900 (JST) From: Curt Sampson Reply-To: pgsql-performance@postgresql.org, Curt Sampson To: Shridhar Daithankar Cc: pgsql-general , Subject: Re: Large databases, performance In-Reply-To: <3D9CB613.1700.A7DEEF0@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/328 X-Sequence-Number: 31326 On Thu, 3 Oct 2002, Shridhar Daithankar wrote: > Well, we were comparing ext3 v/s reiserfs. I don't remember the journalling > mode of ext3 but we did a 10 GB write test. Besides converting the RAID to RAID- > 0 from RAID-5 might have something to do about it. That will have a massive, massive effect on performance. Depending on your RAID subsystem, you can except RAID-0 to be between two and twenty times as fast for writes as RAID-5. If you compared one filesystem on RAID-5 and another on RAID-0, your results are likely not at all indicative of file system performance. Note that I've redirected followups to the pgsql-performance list. Avoiding cross-posting would be nice, since I am getting lots of duplicate messages these days. cjs -- Curt Sampson +81 90 7737 2974 http://www.netbsd.org Don't you know, in this new Dark Age, we're all light. --XTC From pgsql-general-owner@postgresql.org Sun Oct 6 22:30:58 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9FAE5475C98; Sun, 6 Oct 2002 22:30:56 -0400 (EDT) Received: from platonic.cynic.net (platonic.cynic.net [204.80.150.245]) by postgresql.org (Postfix) with ESMTP id 18880475AAC; Sun, 6 Oct 2002 22:30:56 -0400 (EDT) Received: from angelic.cynic.net (angelic-platonic.cvpn.cynic.net [198.73.220.226]) by platonic.cynic.net (Postfix) with ESMTP id 9383FBF4C; Mon, 7 Oct 2002 02:30:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by angelic.cynic.net (Postfix) with ESMTP id 13B958736; Mon, 7 Oct 2002 11:30:58 +0900 (JST) Date: Mon, 7 Oct 2002 11:30:57 +0900 (JST) From: Curt Sampson Reply-To: pgsql-performance@postgresql.org, Curt Sampson To: Shridhar Daithankar Cc: pgsql-hackers@postgresql.org, pgsql-general Subject: Re: Large databases, performance In-Reply-To: <3D9CB8B3.25411.A882D21@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/329 X-Sequence-Number: 31327 On Thu, 3 Oct 2002, Shridhar Daithankar wrote: > Our major concern remains load time as data is generated in real time and is > expecetd in database with in specified time period. If your time period is long enough, you can do what I do, which is to use partial indexes so that the portion of the data being loaded is not indexed. That will speed your loads quite a lot. Aftewards you can either generate another partial index for the range you loaded, or generate a new index over both old and new data, and then drop the old index. The one trick is that the optimizer is not very smart about combining multiple indexes, so you often need to split your queries across the two "partitions" of the table that have separate indexes. > Shall I subscribe to performance? Yes, you really ought to. The list is pgsql-performance@postgresql.org. cjs -- Curt Sampson +81 90 7737 2974 http://www.netbsd.org Don't you know, in this new Dark Age, we're all light. --XTC From pgsql-general-owner@postgresql.org Sun Oct 6 23:20:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E7122476141; Sun, 6 Oct 2002 23:20:40 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 3D9E8476086; Sun, 6 Oct 2002 23:20:40 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g973KYhR015764; Sun, 6 Oct 2002 23:20:34 -0400 (EDT) To: Curt Sampson Cc: pgsql-general , pgsql-hackers@postgresql.org Subject: cross-posts (was Re: Large databases, performance) In-reply-to: References: Comments: In-reply-to Curt Sampson message dated "Mon, 07 Oct 2002 11:27:04 +0900" Date: Sun, 06 Oct 2002 23:20:33 -0400 Message-ID: <15763.1033960833@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/330 X-Sequence-Number: 31328 Curt Sampson writes: > ... Avoiding cross-posting would be nice, since I am getting lots of > duplicate messages these days. Cross-posting is a fact of life, and in fact encouraged, on the pg lists. I suggest adapting. Try sending set all unique your-email-address to the PG majordomo server; this sets you up to get only one copy of each cross-posted message. regards, tom lane From pgsql-general-owner@postgresql.org Mon Oct 7 05:37:06 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1C806476360 for ; Mon, 7 Oct 2002 05:37:04 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 92204476227 for ; Mon, 7 Oct 2002 05:36:58 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g979cWr08521 for ; Mon, 7 Oct 2002 15:08:32 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g979cWv08510; Mon, 7 Oct 2002 15:08:32 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-general Date: Mon, 07 Oct 2002 15:07:29 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Cc: pgsql-performance@postgresql.org Message-ID: <3DA1A331.21316.F7E742B@localhost> In-reply-to: <3D9C3E05.7070906@clearmetrix.com> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/337 X-Sequence-Number: 31335 On 3 Oct 2002 at 8:54, Charles H. Woloszynski wrote: > I'd be curious what happens when you submit more queries than you have > processors (you had four concurrent queries and four CPUs), if you care > to run any additional tests. Also, I'd report the query time in > absolute (like you did) and also in 'Time/number of concurrent queries". > This will give you a sense of how the system is scaling as the workload > increases. Personally I am more concerned about this aspect than the > load time, since I am going to guess that this is where all the time is > spent. OK. I am back from my cave after some more tests are done. Here are the results. I am not repeating large part of it but answering your questions.. Don't ask me how these numbers changed. I am not the person who conducts the test neither I have access to the system. Rest(or most ) of the things remains same.. MySQL 3.23.52 with innodb transaction support: 4 concurrent queries :- 257.36 ms 40 concurrent queries :- 35.12 ms Postgresql 7.2.2 4 concurrent queries :- 257.43 ms 40 concurrent queries :- 41.16 ms Though I can not report oracle numbers, suffice to say that they fall in between these two numbers. Oracle seems to be hell lot faster than mysql/postgresql to load raw data even when it's installed on reiserfs. We plan to run XFS tests later in hope that that would improve mysql/postgresql load times. In this run postgresql has better load time than mysql/innodb ( 18270 sec v/s 17031 sec.) Index creation times are faster as well (100 sec v/s 130 sec). Don't know what parameters are changed. Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. All numbers include indexes. This is really going to be a problem when things are deployed. Any idea how can it be taken down? WAL is out, it's not counted. Schema optimisation is later issue. Right now all three databases are using same schema.. Will it help in this situation if I recompile posgresql with block size say 32K rather than 8K default? Will it saev some overhead and offer better performance in data load etc? Will keep you guys updated.. Regards, Shridhar ----------------------------------------------------------- Shridhar Daithankar LIMS CPE Team Member, PSPL. mailto:shridhar_daithankar@persistent.co.in Phone:- +91-20-5678900 Extn.270 Fax :- +91-20-5678901 ----------------------------------------------------------- From pgsql-general-owner@postgresql.org Mon Oct 7 08:24:37 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BEF1D475B8F for ; Mon, 7 Oct 2002 06:00:41 -0400 (EDT) Received: from bachata.cybertec.at (unknown [62.116.21.146]) by postgresql.org (Postfix) with SMTP id 35A79475921 for ; Mon, 7 Oct 2002 06:00:40 -0400 (EDT) Received: (qmail 4501 invoked from network); 7 Oct 2002 10:00:44 -0000 Received: from unknown (HELO cybertec.at) (62.116.21.147) by 62.116.21.146 with SMTP; 7 Oct 2002 10:00:44 -0000 Message-ID: <3DA15B7C.8010005@cybertec.at> Date: Mon, 07 Oct 2002 12:01:32 +0200 From: =?ISO-8859-1?Q?Hans-J=FCrgen_Sch=F6nig?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830 X-Accept-Language: en-us, en MIME-Version: 1.0 To: shridhar_daithankar@persistent.co.in, pgsql-general@postgresql.org Subject: Re: [pgsql-performance] Large databases, performance References: <3DA1A331.21316.F7E742B@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/355 X-Sequence-Number: 31353 I wonder if the following changes make a difference: - compile PostgreSQL with CFLAGS=' -O3 ' - redefine commit delays also: keep in mind that you might gain a lot of performance by using the SPI if you are running many similar queries try 7.3 - as far as I remeber there is a mechanism which caches recent execution plans. also: some overhead was reduced (tuples, backend startup). Hans >Ok. I am back from my cave after some more tests are done. Here are the >results. I am not repeating large part of it but answering your questions.. > >Don't ask me how these numbers changed. I am not the person who conducts the >test neither I have access to the system. Rest(or most ) of the things remains >same.. > >MySQL 3.23.52 with innodb transaction support: > >4 concurrent queries :- 257.36 ms >40 concurrent queries :- 35.12 ms > >Postgresql 7.2.2 > >4 concurrent queries :- 257.43 ms >40 concurrent queries :- 41.16 ms > >Though I can not report oracle numbers, suffice to say that they fall in >between these two numbers. > >Oracle seems to be hell lot faster than mysql/postgresql to load raw data even >when it's installed on reiserfs. We plan to run XFS tests later in hope that >that would improve mysql/postgresql load times. > >In this run postgresql has better load time than mysql/innodb ( 18270 sec v/s >17031 sec.) Index creation times are faster as well (100 sec v/s 130 sec). >Don't know what parameters are changed. > >Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. All >numbers include indexes. This is really going to be a problem when things are >deployed. Any idea how can it be taken down? > >WAL is out, it's not counted. > >Schema optimisation is later issue. Right now all three databases are using >same schema.. > >Will it help in this situation if I recompile posgresql with block size say 32K >rather than 8K default? Will it saev some overhead and offer better performance >in data load etc? > >Will keep you guys updated.. > >Regards, > Shridhar > >----------------------------------------------------------- >Shridhar Daithankar >LIMS CPE Team Member, PSPL. >mailto:shridhar_daithankar@persistent.co.in >Phone:- +91-20-5678900 Extn.270 >Fax :- +91-20-5678901 >----------------------------------------------------------- > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > -- *Cybertec Geschwinde u Schoenig* Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria Tel: +43/1/913 68 09; +43/664/233 90 75 www.postgresql.at , cluster.postgresql.at , www.cybertec.at , kernel.cybertec.at From pgsql-general-owner@postgresql.org Mon Oct 7 07:51:14 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0F7B5475F4F; Mon, 7 Oct 2002 07:51:13 -0400 (EDT) Received: from lerlaptop.iadfw.net (pppth08-291.ght.iadfw.net [207.136.52.165]) by postgresql.org (Postfix) with ESMTP id 45FC8475D1C; Mon, 7 Oct 2002 07:51:10 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by lerlaptop.iadfw.net (8.12.6/8.12.5) with ESMTP id g97Boxnk000463; Mon, 7 Oct 2002 06:51:00 -0500 (CDT) (envelope-from ler@lerctr.org) Subject: Re: [HACKERS] cross-posts (was Re: Large databases, From: Larry Rosenman To: Tom Lane Cc: Curt Sampson , pgsql-general , pgsql-hackers@postgresql.org In-Reply-To: <15763.1033960833@sss.pgh.pa.us> References: <15763.1033960833@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 07 Oct 2002 06:50:59 -0500 Message-Id: <1033991460.311.6.camel@lerlaptop> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/339 X-Sequence-Number: 31337 On Sun, 2002-10-06 at 22:20, Tom Lane wrote: > Curt Sampson writes: > > ... Avoiding cross-posting would be nice, since I am getting lots of > > duplicate messages these days. > > Cross-posting is a fact of life, and in fact encouraged, on the pg > lists. I suggest adapting. Try sending > set all unique your-email-address > to the PG majordomo server; this sets you up to get only one copy > of each cross-posted message. That doesn't seem to work any more: >>>> set all unique ler@lerctr.org **** The "all" mailing list is not supported at **** PostgreSQL User Support Lists. What do I need to send now? Marc? -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 From pgsql-general-owner@postgresql.org Mon Oct 7 08:22:17 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B9D89475F86 for ; Mon, 7 Oct 2002 07:59:05 -0400 (EDT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 00081475AE5 for ; Mon, 7 Oct 2002 07:59:03 -0400 (EDT) Received: (qmail 24764 invoked by uid 0); 7 Oct 2002 11:59:06 -0000 Received: from chello062178186201.1.15.tuwien.teleweb.at (HELO beeblebrox) (62.178.186.201) by mail.gmx.net (mp008-rz3) with SMTP; 7 Oct 2002 11:59:06 -0000 Message-ID: <00f801c26df9$44465720$4201a8c0@beeblebrox> From: "Michael Paesold" To: "Larry Rosenman" , "Tom Lane" Cc: "Curt Sampson" , "pgsql-general" , References: <15763.1033960833@sss.pgh.pa.us> <1033991460.311.6.camel@lerlaptop> Subject: Re: [HACKERS] cross-posts (was Re: Large databases, Date: Mon, 7 Oct 2002 14:01:25 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/353 X-Sequence-Number: 31351 > On Sun, 2002-10-06 at 22:20, Tom Lane wrote: > > Curt Sampson writes: > > > ... Avoiding cross-posting would be nice, since I am getting lots of > > > duplicate messages these days. > > > > Cross-posting is a fact of life, and in fact encouraged, on the pg > > lists. I suggest adapting. Try sending > > set all unique your-email-address > > to the PG majordomo server; this sets you up to get only one copy > > of each cross-posted message. > That doesn't seem to work any more: > > >>>> set all unique ler@lerctr.org > **** The "all" mailing list is not supported at > **** PostgreSQL User Support Lists. > > What do I need to send now? > > Marc? it is: set ALL unique your-email if you also don't want to get emails that have already been cc'd to you, you can use: set ALL eliminatecc your-email for a full list of set options send: help set to majordomo. Regards, Michael Paesold From pgsql-general-owner@postgresql.org Mon Oct 7 08:04:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6D474475F86; Mon, 7 Oct 2002 08:04:45 -0400 (EDT) Received: from lerlaptop.iadfw.net (pppth08-291.ght.iadfw.net [207.136.52.165]) by postgresql.org (Postfix) with ESMTP id 25F40475F4F; Mon, 7 Oct 2002 08:04:44 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by lerlaptop.iadfw.net (8.12.6/8.12.5) with ESMTP id g97C4Xnk000539; Mon, 7 Oct 2002 07:04:34 -0500 (CDT) (envelope-from ler@lerctr.org) Subject: Re: [HACKERS] cross-posts (was Re: Large databases, From: Larry Rosenman To: Michael Paesold Cc: Tom Lane , Curt Sampson , pgsql-general , pgsql-hackers@postgresql.org In-Reply-To: <00f801c26df9$44465720$4201a8c0@beeblebrox> References: <15763.1033960833@sss.pgh.pa.us> <1033991460.311.6.camel@lerlaptop> <00f801c26df9$44465720$4201a8c0@beeblebrox> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 07 Oct 2002 07:04:33 -0500 Message-Id: <1033992275.311.12.camel@lerlaptop> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/340 X-Sequence-Number: 31338 On Mon, 2002-10-07 at 07:01, Michael Paesold wrote: > > On Sun, 2002-10-06 at 22:20, Tom Lane wrote: > > > Curt Sampson writes: > > > > ... Avoiding cross-posting would be nice, since I am getting lots of > > > > duplicate messages these days. > > > > > > Cross-posting is a fact of life, and in fact encouraged, on the pg > > > lists. I suggest adapting. Try sending > > > set all unique your-email-address > > > to the PG majordomo server; this sets you up to get only one copy > > > of each cross-posted message. > > That doesn't seem to work any more: > > > > >>>> set all unique ler@lerctr.org > > **** The "all" mailing list is not supported at > > **** PostgreSQL User Support Lists. > > > > What do I need to send now? > > > > Marc? > > it is: > set ALL unique your-email > > if you also don't want to get emails that have already been cc'd to you, you > can use: > > set ALL eliminatecc your-email > > for a full list of set options send: > > help set > > to majordomo. Thanks. That worked great. (I use Mailman, and didn't realize the ALL needed to be capitalized. LER -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 From pgsql-general-owner@postgresql.org Mon Oct 7 10:07:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9AA5A4768CE for ; Mon, 7 Oct 2002 10:07:54 -0400 (EDT) Received: from email01.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.97]) by postgresql.org (Postfix) with SMTP id 3E3D647681A for ; Mon, 7 Oct 2002 10:07:52 -0400 (EDT) Received: (qmail 167656 invoked from network); 7 Oct 2002 14:07:55 -0000 Received: from m157p026.dipool.highway.telekom.at (HELO cantor) ([62.46.9.154]) (envelope-sender ) by qmail1rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 7 Oct 2002 14:07:55 -0000 From: Manfred Koizar To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: Large databases, performance Date: Mon, 07 Oct 2002 16:10:26 +0200 Message-ID: <69v2qu4n8fdt5do8dids2a9m98p0q8bu9r@4ax.com> References: <3D9C3E05.7070906@clearmetrix.com> <3DA1A331.21316.F7E742B@localhost> In-Reply-To: <3DA1A331.21316.F7E742B@localhost> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/378 X-Sequence-Number: 31376 On Mon, 07 Oct 2002 15:07:29 +0530, "Shridhar Daithankar" wrote: >Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. All >numbers include indexes. This is really going to be a problem when things are >deployed. Any idea how can it be taken down? Shridhar, if i'm not mistaken, a char(n)/varchar(n) column is stored as a 32-bit integer specifying the length followed by as many characters as the length tells. On 32-bit Intel hardware this structure is aligned on a 4-byte boundary. For your row layout this gives the following sizes (look at the "phys size" column): | Field Field Null Indexed phys mini | Name Type size |-------------------------------------------- | type int no no 4 4 | esn char (10) no yes 16 11 | min char (10) no yes 16 11 | datetime timestamp no yes 8 8 | opc0 char (3) no no 8 4 | opc1 char (3) no no 8 4 | opc2 char (3) no no 8 4 | dpc0 char (3) no no 8 4 | dpc1 char (3) no no 8 4 | dpc2 char (3) no no 8 4 | npa char (3) no no 8 4 | nxx char (3) no no 8 4 | rest char (4) no no 8 5 | field0 int yes no 4 4 | field1 char (4) yes no 8 5 | field2 int yes no 4 4 | field3 char (4) yes no 8 5 | field4 int yes no 4 4 | field5 char (4) yes no 8 5 | field6 int yes no 4 4 | field7 char (4) yes no 8 5 | field8 int yes no 4 4 | field9 char (4) yes no 8 5 | ----- ----- | 176 116 Ignoring nulls for now, you have to add 32 bytes for a v7.2 heap tuple header and 4 bytes for ItemIdData per tuple, ending up with 212 bytes per tuple or ca. 85 GB heap space for 432000000 tuples. Depending on fill factor similar calculations give some 30 GB for your index. Now if we had a datatype with only one byte for the string length, char columns could be byte aligned and we'd have column sizes given under "mini" in the table above. The columns would have to be rearranged according to alignment requirements. Thus 60 bytes per heap tuple and 8 bytes per index tuple could be saved, resulting in a database size of ~ 85 GB (index included). And I bet this would be significantly faster, too. Hackers, do you think it's possible to hack together a quick and dirty patch, so that string length is represented by one byte? IOW can a database be built that doesn't contain any char/varchar/text value longer than 255 characters in the catalog? If I'm not told that this is impossibly, I'd give it a try. Shridhar, if such a patch can be made available, would you be willing to test it? What can you do right now? Try using v7.3 beta and creating your table WITHOUT OIDS. This saves 8 bytes per tuple; not much, but better save 4% than nothing. Servus Manfred From pgsql-general-owner@postgresql.org Mon Oct 7 10:18:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BE7454768BE for ; Mon, 7 Oct 2002 10:18:01 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 6D85C476663 for ; Mon, 7 Oct 2002 10:17:59 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g97EJar08753 for ; Mon, 7 Oct 2002 19:49:36 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g97EJav08731; Mon, 7 Oct 2002 19:49:36 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Date: Mon, 07 Oct 2002 19:48:31 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA1E50F.4394.107FF85D@localhost> In-reply-to: <69v2qu4n8fdt5do8dids2a9m98p0q8bu9r@4ax.com> References: <3DA1A331.21316.F7E742B@localhost> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/382 X-Sequence-Number: 31380 On 7 Oct 2002 at 16:10, Manfred Koizar wrote: > if i'm not mistaken, a char(n)/varchar(n) column is stored as a 32-bit > integer specifying the length followed by as many characters as the > length tells. On 32-bit Intel hardware this structure is aligned on a > 4-byte boundary. That shouldn't be necessary for a char field as space is always pre-allocated. Sounds like a possible area of imporvement to me, if that's the case.. > Hackers, do you think it's possible to hack together a quick and dirty > patch, so that string length is represented by one byte? IOW can a > database be built that doesn't contain any char/varchar/text value > longer than 255 characters in the catalog? I say if it's a char field, there should be no indicator of length as it's not required. Just store those many characters straight ahead.. > > If I'm not told that this is impossibly, I'd give it a try. Shridhar, > if such a patch can be made available, would you be willing to test > it? Sure. But the server machine is not available this week. Some other project is using it. So the results won't be out unless at least a week from now. > What can you do right now? Try using v7.3 beta and creating your > table WITHOUT OIDS. This saves 8 bytes per tuple; not much, but > better save 4% than nothing. IIRC there was some header optimisation which saved 4 bytes. So without OIDs that should save 8. Would do that as first next thing. I talked to my friend regarding postgresql surpassing mysql substantially in this test. He told me that the last test where postgresql took 23000+/150 sec for load/index and mysql took 18,000+/130 index, postgresql was running in default configuration. He forgot to copy postgresql.conf to data directory after he modified it. This time results are correct. Postgresql loads data faster, indexes it faster and queries in almost same time.. Way to go.. Regards, Shridhar ----------------------------------------------------------- Shridhar Daithankar LIMS CPE Team Member, PSPL. mailto:shridhar_daithankar@persistent.co.in Phone:- +91-20-5678900 Extn.270 Fax :- +91-20-5678901 ----------------------------------------------------------- From pgsql-general-owner@postgresql.org Mon Oct 7 10:32:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 981564764F9; Mon, 7 Oct 2002 10:32:44 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 2F37E476879; Mon, 7 Oct 2002 10:30:55 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g97EUbhR023490; Mon, 7 Oct 2002 10:30:37 -0400 (EDT) To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: [pgsql-performance] Large databases, performance In-reply-to: <3DA1A331.21316.F7E742B@localhost> References: <3DA1A331.21316.F7E742B@localhost> Comments: In-reply-to "Shridhar Daithankar" message dated "Mon, 07 Oct 2002 15:07:29 +0530" Date: Mon, 07 Oct 2002 10:30:37 -0400 Message-ID: <23489.1034001037@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/383 X-Sequence-Number: 31381 "Shridhar Daithankar" writes: > MySQL 3.23.52 with innodb transaction support: > 4 concurrent queries :- 257.36 ms > 40 concurrent queries :- 35.12 ms > Postgresql 7.2.2 > 4 concurrent queries :- 257.43 ms > 40 concurrent queries :- 41.16 ms I find this pretty fishy. The extreme similarity of the 4-client numbers seems improbable, from what I know of the two databases. I suspect your numbers are mostly measuring some non-database-related overhead --- communications overhead, maybe? > Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. All > numbers include indexes. This is really going to be a problem when things are > deployed. Any idea how can it be taken down? 7.3 should be a little bit better because of Manfred's work on reducing tuple header size --- if you create your tables WITHOUT OIDS, you should save 8 bytes per row compared to earlier releases. regards, tom lane From pgsql-general-owner@postgresql.org Mon Oct 7 10:39:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 721BA476358 for ; Mon, 7 Oct 2002 10:39:25 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 940DB476237 for ; Mon, 7 Oct 2002 10:39:22 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g97EexL11100 for ; Mon, 7 Oct 2002 20:10:59 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g97Eexv11090; Mon, 7 Oct 2002 20:10:59 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Date: Mon, 07 Oct 2002 20:09:55 +0530 MIME-Version: 1.0 Subject: Re: [pgsql-performance] Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA1EA13.16626.10939155@localhost> References: <3DA1A331.21316.F7E742B@localhost> In-reply-to: <23489.1034001037@sss.pgh.pa.us> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/384 X-Sequence-Number: 31382 On 7 Oct 2002 at 10:30, Tom Lane wrote: > "Shridhar Daithankar" writes: > > MySQL 3.23.52 with innodb transaction support: > > > 4 concurrent queries :- 257.36 ms > > 40 concurrent queries :- 35.12 ms > > > Postgresql 7.2.2 > > > 4 concurrent queries :- 257.43 ms > > 40 concurrent queries :- 41.16 ms > > I find this pretty fishy. The extreme similarity of the 4-client > numbers seems improbable, from what I know of the two databases. > I suspect your numbers are mostly measuring some non-database-related > overhead --- communications overhead, maybe? I don't know but three numbers, postgresql/mysql/oracle all are 25x.xx ms. The clients were on same machie as of server. So no real area to point at.. > > > Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. All > > numbers include indexes. This is really going to be a problem when things are > > deployed. Any idea how can it be taken down? > > 7.3 should be a little bit better because of Manfred's work on reducing > tuple header size --- if you create your tables WITHOUT OIDS, you should > save 8 bytes per row compared to earlier releases. Got it.. Bye Shridhar -- Sweater, n.: A garment worn by a child when its mother feels chilly. From pgsql-general-owner@postgresql.org Mon Oct 7 11:22:09 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0069A47621C; Mon, 7 Oct 2002 11:22:09 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 520A5476720; Mon, 7 Oct 2002 11:21:58 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g97FLvhR023898; Mon, 7 Oct 2002 11:21:57 -0400 (EDT) To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: [pgsql-performance] Large databases, performance In-reply-to: <3DA1E50F.4394.107FF85D@localhost> References: <3DA1A331.21316.F7E742B@localhost> <3DA1E50F.4394.107FF85D@localhost> Comments: In-reply-to "Shridhar Daithankar" message dated "Mon, 07 Oct 2002 19:48:31 +0530" Date: Mon, 07 Oct 2002 11:21:57 -0400 Message-ID: <23897.1034004117@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/390 X-Sequence-Number: 31388 "Shridhar Daithankar" writes: > I say if it's a char field, there should be no indicator of length as > it's not required. Just store those many characters straight ahead.. Your assumption fails when considering UNICODE or other multibyte character encodings. regards, tom lane From pgsql-general-owner@postgresql.org Mon Oct 7 11:20:14 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BD062476353 for ; Mon, 7 Oct 2002 11:20:13 -0400 (EDT) Received: from email04.aon.at (WARSL402PIP5.highway.telekom.at [195.3.96.79]) by postgresql.org (Postfix) with SMTP id 5403247621C for ; Mon, 7 Oct 2002 11:20:08 -0400 (EDT) Received: (qmail 367988 invoked from network); 7 Oct 2002 15:20:09 -0000 Received: from m165p018.dipool.highway.telekom.at (HELO cantor) ([62.46.10.146]) (envelope-sender ) by qmail5rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 7 Oct 2002 15:20:09 -0000 From: Manfred Koizar To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: Large databases, performance Date: Mon, 07 Oct 2002 17:22:41 +0200 Message-ID: References: <3DA1A331.21316.F7E742B@localhost> <69v2qu4n8fdt5do8dids2a9m98p0q8bu9r@4ax.com> <3DA1E50F.4394.107FF85D@localhost> In-Reply-To: <3DA1E50F.4394.107FF85D@localhost> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/389 X-Sequence-Number: 31387 On Mon, 07 Oct 2002 19:48:31 +0530, "Shridhar Daithankar" wrote: >I say if it's a char field, there should be no indicator of length as it's not >required. Just store those many characters straight ahead.. This is out of reach for a quick hack ... >Sure. But the server machine is not available this week. Some other project is >using it. So the results won't be out unless at least a week from now. :-) >This time results are correct. Postgresql loads data faster, indexes it faster >and queries in almost same time.. Way to go.. Great! And now let's work on making selects faster, too. Servus Manfred From pgsql-general-owner@postgresql.org Tue Oct 8 12:37:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 333D0476792; Mon, 7 Oct 2002 11:42:17 -0400 (EDT) Received: from smxsat1.smxs.net (smxsat1.smxs.net [213.150.10.1]) by postgresql.org (Postfix) with ESMTP id AF8684767BE; Mon, 7 Oct 2002 11:42:14 -0400 (EDT) Received: from m01x1.s-mxs.net [10.3.55.201] by smxsat1.smxs.net over TLS secured channel with XWall v3.22i ; Mon, 7 Oct 2002 17:42:14 +0200 Received: from m0102.s-mxs.net [10.3.55.2] by m01x1.s-mxs.net with XWall v3.22h ; Mon, 7 Oct 2002 17:42:13 +0200 Received: from m0114.s-mxs.net ([10.3.55.14]) by m0102.s-mxs.net with Microsoft SMTPSVC(5.0.2195.5329); Mon, 7 Oct 2002 17:42:12 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: [HACKERS] Large databases, performance Date: Mon, 7 Oct 2002 17:42:12 +0200 Message-ID: <46C15C39FEB2C44BA555E356FBCD6FA4887A5A@m0114.s-mxs.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [HACKERS] [GENERAL] Large databases, performance Thread-Index: AcJuC2mXfpTsQsS8SYipEwKJNAatyAADFkzQ From: "Zeugswetter Andreas SB SD" To: "Manfred Koizar" , Cc: , "pgsql-general" , X-OriginalArrivalTime: 07 Oct 2002 15:42:12.0994 (UTC) FILETIME=[1AEF0E20:01C26E18] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/462 X-Sequence-Number: 31460 > if i'm not mistaken, a char(n)/varchar(n) column is stored as a 32-bit > integer specifying the length followed by as many characters as the > length tells. On 32-bit Intel hardware this structure is aligned on a > 4-byte boundary. Yes. > | opc0 char (3) no no 8 4 > | opc1 char (3) no no 8 4 > | opc2 char (3) no no 8 4 > Hackers, do you think it's possible to hack together a quick and dirty > patch, so that string length is represented by one byte? IOW can a > database be built that doesn't contain any char/varchar/text value > longer than 255 characters in the catalog? Since he is only using fixchar how about doing a fixchar implemetation, tha= t=20 does not store length at all ? It is the same for every row anyways ! Andreas From pgsql-general-owner@postgresql.org Mon Oct 7 15:21:11 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 11E9B4768E9; Mon, 7 Oct 2002 15:21:11 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.chi-il.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id 04BA947671D; Mon, 7 Oct 2002 15:19:54 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 14:15:01 -0500 Reply-To: From: "Marie G. Tuite" To: "Pgsql-General@Postgresql. Org" , Subject: sloooow query Date: Mon, 7 Oct 2002 14:22:09 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/404 X-Sequence-Number: 31402 Hello all, I am experiencing slow db performance. I have vacuumed, analyzed, reindexed using the force option and performance remains the same - dog-slow :( If I drop and recreate the database, performance is normal, so this suggests a problem with the indexes? I also took a look at the postgresql.conf and all appears fine. There are many instances of the same database running on different servers and not all servers are experiencing the problem. Thanks in advance for any suggestions. Marie From pgsql-performance-owner@postgresql.org Mon Oct 7 15:26:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 739A447691D for ; Mon, 7 Oct 2002 15:26:52 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id A46524768E9 for ; Mon, 7 Oct 2002 15:26:51 -0400 (EDT) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1774269; Mon, 07 Oct 2002 12:25:23 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 12:29:17 -0700 X-Mailer: KMail [version 1.4] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210071229.17873.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/39 X-Sequence-Number: 56 Marie, > I am experiencing slow db performance. I have vacuumed, analyzed, reinde= xed > using the force option and performance remains the same - dog-slow :( If= I > drop and recreate the database, performance is normal, so this suggests a > problem with the indexes? I also took a look at the postgresql.conf and = all > appears fine. There are many instances of the same database running on > different servers and not all servers are experiencing the problem. Please post the following: 1) A copy of the relevant portions of your database schema. 2) The query that is running slowly. 3) The results of running EXPLAIN on that query. 4) Your PostgreSQL version and operating system 5) Any other relevant information about your databases, such as the quantit= y=20 of inserts and deletes on the relevant tables. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Oct 7 15:30:09 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 62DD5475F80 for ; Mon, 7 Oct 2002 15:30:08 -0400 (EDT) Received: from new-smtp2.ihug.com.au (new-smtp2.ihug.com.au [203.109.250.28]) by postgresql.org (Postfix) with ESMTP id AF89F475F66 for ; Mon, 7 Oct 2002 15:30:07 -0400 (EDT) Received: from p393-tnt2.mel.ihug.com.au (postgresql.org) [203.173.165.139] by new-smtp2.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 17ydZt-0006Ew-00; Tue, 08 Oct 2002 05:30:05 +1000 Message-ID: <3DA1E0BB.236FCC17@postgresql.org> Date: Tue, 08 Oct 2002 05:30:03 +1000 From: Justin Clift X-Mailer: Mozilla 4.79 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: josh@agliodbs.com Cc: marie.tuite@edisonaffiliates.com, pgsql-performance@postgresql.org Subject: Re: sloooow query References: <200210071229.17873.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/40 X-Sequence-Number: 57 Josh Berkus wrote: > > Marie, > > > I am experiencing slow db performance. I have vacuumed, analyzed, reindexed > > using the force option and performance remains the same - dog-slow :( If I > > drop and recreate the database, performance is normal, so this suggests a > > problem with the indexes? I also took a look at the postgresql.conf and all > > appears fine. There are many instances of the same database running on > > different servers and not all servers are experiencing the problem. > > Please post the following: > 1) A copy of the relevant portions of your database schema. > 2) The query that is running slowly. > 3) The results of running EXPLAIN on that query. > 4) Your PostgreSQL version and operating system > 5) Any other relevant information about your databases, such as the quantity > of inserts and deletes on the relevant tables. 6) And the sort_mem, shared_buffers, vacuum_mem, wal_buffers, and wal_files settings from your postgresql.conf file, if possible. :-) Regards and best wishes, Justin Clift > -- > -Josh Berkus > Aglio Database Solutions > San Francisco > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi From pgsql-performance-owner@postgresql.org Mon Oct 7 15:46:58 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8EA88475FC6 for ; Mon, 7 Oct 2002 15:46:56 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.chi-il.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id A9A2E475F80 for ; Mon, 7 Oct 2002 15:46:55 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 14:42:08 -0500 Reply-To: From: "Marie G. Tuite" To: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 14:49:16 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <200210071229.17873.josh@agliodbs.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/41 X-Sequence-Number: 58 Josh, Thanks for the reply. I pg_dumped the first database having performance problems and reloaded it into a new database on the same server. The query ran normally when I reloaded it. There is no difference in hardware, schema or anything else. project=# select version(); version ------------------------------------------------------------- PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96 (1 row) [mtuite@area52 mtuite]$ uname -a Linux area52.spacedock.com 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown Below is the explain for the reload. bm221=# \i bad.qry psql:bad.qry:78: NOTICE: QUERY PLAN: Sort (cost=273.71..273.71 rows=1 width=237) (actual time=143.82..143.96 rows=181 loops=1) -> Group (cost=273.53..273.70 rows=1 width=237) (actual time=136.98..140.78 rows=181 loops=1) -> Sort (cost=273.53..273.53 rows=7 width=237) (actual time=136.95..137.11 rows=181 loops=1) -> Merge Join (cost=273.37..273.43 rows=7 width=237) (actual time=124.41..129.72 rows=181 loops=1) -> Sort (cost=162.24..162.24 rows=7 width=216) (actual time=51.83..52.00 rows=181 loops=1) -> Subquery Scan student_set (cost=161.09..162.14 rows=7 width=216) (actual time=48.12..50.49 rows=181 loops=1) -> Unique (cost=161.09..162.14 rows=7 width=216) (actual time=48.10..49.45 rows=181 loops=1) -> Sort (cost=161.09..161.09 rows=70 width=216) (actual time=48.09..48.26 rows=181 loops=1) -> Hash Join (cost=130.58..158.96 rows=70 width=216) (actual time=43.26..47.11 rows=181 loops=1) -> Seq Scan on classes c (cost=0.00..20.00 rows=1000 width=72) (actual time=0.12..1.78 rows=332 loops=1) -> Hash (cost=130.55..130.55 rows=14 width=144) (actual time=43.02..43.02 rows=0 loops=1) -> Hash Join (cost=105.38..130.55 rows=14 width=144) (actual time=31.13..42.44 rows=181 loops=1) -> Seq Scan on user_common uc (cost=0.00..20.00 rows=1000 width=80) (actual time=0.12..7.07 rows=1045 loops=1) -> Hash (cost=105.37..105.37 rows=3 width=64) (actual time=30.91..30.91 rows=0 loops=1) -> Hash Join (cost=77.46..105.37 rows=3 width=64) (actual time=4.79..30.46 rows=181 loops=1) -> Seq Scan on student_class_rlt scr (cost=0.00..22.50 rows=995 width=24) (actual time=0.25..23.74 rows=527 loops=1) -> Hash (cost=77.45..77.45 rows=5 width=40) (actual time=4.02..4.02 rows=0 loops=1) -> Hash Join (cost=52.38..77.45 rows=5 width=40) (actual time=3.28..3.96 rows=27 loops=1) -> Seq Scan on bm_subscriptions_rlt bsr (cost=0.00..20.00 rows=1000 width=8) (actual time=0.11..0.47 rows=114 loops=1) -> Hash (cost=52.38..52.38 rows=1 width=32) (actual time=3.10..3.10 rows=0 loops=1) -> Hash Join (cost=4.83..52.38 rows=1 width=32) (actual time=2.23..3.07 rows=11 loops=1) -> Seq Scan on bm_publications bp (cost=0.00..47.50 rows=11 width=12) (actual time=1.49..2.25 rows=11 loops=1) -> Hash (cost=4.82..4.82 rows=1 width=20) (actual time=0.63..0.63 rows=0 loops=1) -> Index Scan using bm_publication_events_pkey on bm_publication_events bpe (cost=0.00..4.82 rows=1 width=20) (actual time=0.60..0.61 rows=1 loops=1) -> Sort (cost=111.13..111.13 rows=18 width=21) (actual time=72.51..73.15 rows=770 loops=1) -> Subquery Scan participation_set (cost=22.51..110.75 rows=18 width=21) (actual time=1.32..57.28 rows=809 loops=1) -> Hash Join (cost=22.51..110.75 rows=18 width=21) (actual time=1.30..52.21 rows=809 loops=1) -> Seq Scan on bm_user_results bur (cost=0.00..70.01 rows=3601 width=17) (actual time=0.14..18.53 rows=3601 loops=1) -> Hash (cost=22.50..22.50 rows=5 width=4) (actual time=0.91..0.91 rows=0 loops=1) -> Seq Scan on bm_publications bp (cost=0.00..22.50 rows=5 width=4) (actual time=0.33..0.71 rows=98 loops=1) Total runtime: 145.69 msec EXPLAIN bm221=# Here is the explain from the original database: project=# \i bad.qry psql:bad.qry:78: NOTICE: QUERY PLAN: Sort (cost=337.23..337.23 rows=1 width=237) (actual time=14903.87..14904.05 rows=181 loops=1) -> Group (cost=337.19..337.22 rows=1 width=237) (actual time=14895.90..14900.55 rows=181 loops=1) -> Sort (cost=337.19..337.19 rows=1 width=237) (actual time=14895.87..14896.09 rows=181 loops=1) -> Nested Loop (cost=214.62..337.18 rows=1 width=237) (actual time=149.50..14886.63 rows=181 loops=1) -> Subquery Scan student_set (cost=208.82..208.84 rows=1 width=115) (actual time=64.03..69.44 rows=181 loops=1) -> Unique (cost=208.82..208.84 rows=1 width=115) (actual time=64.02..67.25 rows=181 loops=1) -> Sort (cost=208.82..208.82 rows=1 width=115) (actual time=64.01..64.36 rows=181 loops=1) -> Nested Loop (cost=16.54..208.81 rows=1 width=115) (actual time=5.21..62.66 rows=181 loops=1) -> Nested Loop (cost=16.54..203.55 rows=1 width=88) (actual time=5.11..52.60 rows=181 loops=1) -> Hash Join (cost=16.54..197.63 rows=1 width=64) (actual time=4.55..37.75 rows=181 loops=1) -> Seq Scan on student_class_rlt scr (cost=0.00..178.16 rows=574 width=24) (actual time=0.02..29.59 rows=527 loops=1) -> Hash (cost=16.54..16.54 rows=2 width=40) (actual time=3.84..3.84 rows=0 loops=1) -> Hash Join (cost=13.80..16.54 rows=2 width=40) (actual time=2.91..3.77 rows=27 loops=1) -> Seq Scan on bm_subscriptions_rlt bsr (cost=0.00..2.14 rows=114 width=8) (actual time=0.01..0.50 rows=114 loops=1) -> Hash (cost=13.80..13.80 rows=2 width=32) (actual time=2.81..2.81 rows=0 loops=1) -> Hash Join (cost=1.06..13.80 rows=2 width=32) (actual time=1.74..2.78 rows=11 loops=1) -> Seq Scan on bm_publications bp (cost=0.00..12.65 rows=11 width=12) (actual time=1.56..2.51 rows=11 loops=1) -> Hash (cost=1.06..1.06 rows=1 width=20) (actual time=0.06..0.06 rows=0 loops=1) -> Seq Scan on bm_publication_events bpe (cost=0.00..1.06 rows=1 width=20) (actual time=0.04..0.05 rows=1 loops=1) -> Index Scan using user_common_pkey on user_common uc (cost=0.00..5.90 rows=1 width=24) (actual time=0.05..0.06 rows=1 loops=181) -> Index Scan using class_pkey on classes c (cost=0.00..5.25 rows=1 width=27) (actual time=0.03..0.04 rows=1 loops=181) -> Subquery Scan participation_set (cost=5.79..109.63 rows=1248 width=21) (actual time=1.19..78.18 rows=816 loops=181) -> Hash Join (cost=5.79..109.63 rows=1248 width=21) (actual time=1.18..71.10 rows=816 loops=181) -> Seq Scan on bm_user_results bur (cost=0.00..70.16 rows=3616 width=17) (actual time=0.01..20.96 rows=3620 loops=181) -> Hash (cost=5.55..5.55 rows=98 width=4) (actual time=1.05..1.05 rows=0 loops=181) -> Seq Scan on bm_publications bp (cost=0.00..5.55 rows=98 width=4) (actual time=0.33..0.82 rows=98 loops=181) Total runtime: 14905.87 msec EXPLAIN project=# Here is the query: explain analyze select student_set.pub_id as pub_id, student_set.class_id as class, student_set.class_name as class_name, student_set.user_id as student, student_set.first_name, student_set.last_name, participation_set.started, participation_set.complete, day,month from ( select distinct scr.user_id, scr.class_id, uc.first_name, uc.last_name, bp.bm_publication_id as pub_id, c.class_name from student_class_rlt scr, user_common uc, bm_subscriptions_rlt bsr, bm_publications bp CROSS JOIN bm_publication_events bpe, classes c where bpe.bm_publication_event_id = 4 and bpe.bm_publication_event_id = bp.bm_publication_event_id and bp.bm_series_id = bsr.bm_series_id and bsr.class_id = scr.class_id and scr.class_id = c.class_id and (scr.end_date is null or scr.end_date >= bpe.due_date) and scr.start_date <= bpe.publication_date and scr.status_id != 2 and scr.user_id = uc.user_id and bp.bm_publication_id in ( 4,25,1,3,26,19, ,11,27,90,20,28 ) ) student_set left join ( select user_id, initial_timestmp as started, to_char( initial_timestmp, 'MM/DD' ) as day, to_char( initial_timestmp, 'Month YYYY' ) as month, complete, bur.bm_publication_id as pub_id from bm_publications bp, bm_user_results bur where bp.bm_publication_event_id = 4 and bp.bm_publication_id = bur.bm_publication_id ) participation_set on ( student_set.user_id = participation_set.user_id and student_set.pub_id = participation_set.pub_id ) group by student_set.pub_id, class, class_name, student, last_name, first_name, started, complete, day, month order by student_set.pub_id, class, last_name, month, day ; Thanks. > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Josh Berkus > Sent: Monday, October 07, 2002 2:29 PM > To: marie.tuite@edisonaffiliates.com; pgsql-performance@postgresql.org > Subject: Re: [pgsql-performance] sloooow query > > > > Marie, > > > I am experiencing slow db performance. I have vacuumed, > analyzed, reindexed > > using the force option and performance remains the same - > dog-slow :( If I > > drop and recreate the database, performance is normal, so this > suggests a > > problem with the indexes? I also took a look at the > postgresql.conf and all > > appears fine. There are many instances of the same database running on > > different servers and not all servers are experiencing the problem. > > Please post the following: > 1) A copy of the relevant portions of your database schema. > 2) The query that is running slowly. > 3) The results of running EXPLAIN on that query. > 4) Your PostgreSQL version and operating system > 5) Any other relevant information about your databases, such as > the quantity > of inserts and deletes on the relevant tables. > > -- > -Josh Berkus > Aglio Database Solutions > San Francisco > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > From pgsql-performance-owner@postgresql.org Mon Oct 7 15:51:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A80B04760D3; Mon, 7 Oct 2002 15:51:14 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.chi-il.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id C08264760CE; Mon, 7 Oct 2002 15:51:13 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 14:46:27 -0500 Reply-To: From: "Marie G. Tuite" To: "Justin Clift" , Cc: Subject: Re: sloooow query Date: Mon, 7 Oct 2002 14:53:35 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <3DA1E0BB.236FCC17@postgresql.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/42 X-Sequence-Number: 59 Here is a show all: Thanks, project-# ; NOTICE: enable_seqscan is on NOTICE: enable_indexscan is on NOTICE: enable_tidscan is on NOTICE: enable_sort is on NOTICE: enable_nestloop is on NOTICE: enable_mergejoin is on NOTICE: enable_hashjoin is on NOTICE: ksqo is off NOTICE: geqo is on NOTICE: tcpip_socket is on NOTICE: ssl is off NOTICE: fsync is on NOTICE: silent_mode is off NOTICE: log_connections is off NOTICE: log_timestamp is off NOTICE: log_pid is off NOTICE: debug_print_query is off NOTICE: debug_print_parse is off NOTICE: debug_print_rewritten is off NOTICE: debug_print_plan is off NOTICE: debug_pretty_print is off NOTICE: show_parser_stats is off NOTICE: show_planner_stats is off NOTICE: show_executor_stats is off NOTICE: show_query_stats is off NOTICE: stats_start_collector is on NOTICE: stats_reset_on_server_start is on NOTICE: stats_command_string is off NOTICE: stats_row_level is off NOTICE: stats_block_level is off NOTICE: trace_notify is off NOTICE: hostname_lookup is off NOTICE: show_source_port is off NOTICE: sql_inheritance is on NOTICE: australian_timezones is off NOTICE: fixbtree is on NOTICE: password_encryption is off NOTICE: transform_null_equals is off NOTICE: geqo_threshold is 11 NOTICE: geqo_pool_size is 0 NOTICE: geqo_effort is 1 NOTICE: geqo_generations is 0 NOTICE: geqo_random_seed is -1 NOTICE: deadlock_timeout is 1000 NOTICE: syslog is 0 NOTICE: max_connections is 64 NOTICE: shared_buffers is 128 NOTICE: port is 5432 NOTICE: unix_socket_permissions is 511 NOTICE: sort_mem is 1024 NOTICE: vacuum_mem is 8192 NOTICE: max_files_per_process is 1000 NOTICE: debug_level is 0 NOTICE: max_expr_depth is 10000 NOTICE: max_fsm_relations is 100 NOTICE: max_fsm_pages is 10000 NOTICE: max_locks_per_transaction is 64 NOTICE: authentication_timeout is 60 NOTICE: pre_auth_delay is 0 NOTICE: checkpoint_segments is 3 NOTICE: checkpoint_timeout is 300 NOTICE: wal_buffers is 8 NOTICE: wal_files is 0 NOTICE: wal_debug is 0 NOTICE: commit_delay is 0 NOTICE: commit_siblings is 5 NOTICE: effective_cache_size is 1000 NOTICE: random_page_cost is 4 NOTICE: cpu_tuple_cost is 0.01 NOTICE: cpu_index_tuple_cost is 0.001 NOTICE: cpu_operator_cost is 0.0025 NOTICE: geqo_selection_bias is 2 NOTICE: default_transaction_isolation is read committed NOTICE: dynamic_library_path is $libdir NOTICE: krb_server_keyfile is FILE:/etc/pgsql/krb5.keytab NOTICE: syslog_facility is LOCAL0 NOTICE: syslog_ident is postgres NOTICE: unix_socket_group is unset NOTICE: unix_socket_directory is unset NOTICE: virtual_host is unset NOTICE: wal_sync_method is fdatasync NOTICE: DateStyle is ISO with US (NonEuropean) conventions NOTICE: Time zone is unset NOTICE: TRANSACTION ISOLATION LEVEL is READ COMMITTED NOTICE: Current client encoding is 'SQL_ASCII' NOTICE: Current server encoding is 'SQL_ASCII' NOTICE: Seed for random number generator is unavailable SHOW VARIABLE project=# > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Justin Clift > Sent: Monday, October 07, 2002 2:30 PM > To: josh@agliodbs.com > Cc: marie.tuite@edisonaffiliates.com; pgsql-performance@postgresql.org > Subject: Re: [pgsql-performance] sloooow query > > > Josh Berkus wrote: > > > > Marie, > > > > > I am experiencing slow db performance. I have vacuumed, > analyzed, reindexed > > > using the force option and performance remains the same - > dog-slow :( If I > > > drop and recreate the database, performance is normal, so > this suggests a > > > problem with the indexes? I also took a look at the > postgresql.conf and all > > > appears fine. There are many instances of the same database > running on > > > different servers and not all servers are experiencing the problem. > > > > Please post the following: > > 1) A copy of the relevant portions of your database schema. > > 2) The query that is running slowly. > > 3) The results of running EXPLAIN on that query. > > 4) Your PostgreSQL version and operating system > > 5) Any other relevant information about your databases, such as > the quantity > > of inserts and deletes on the relevant tables. > > 6) And the sort_mem, shared_buffers, vacuum_mem, wal_buffers, and > wal_files settings from your postgresql.conf file, if possible. > > :-) > > Regards and best wishes, > > Justin Clift > > > > -- > > -Josh Berkus > > Aglio Database Solutions > > San Francisco > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > -- > "My grandfather once told me that there are two kinds of people: those > who work and those who take the credit. He told me to try to be in the > first group; there was less competition there." > - Indira Gandhi > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Mon Oct 7 16:10:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EB42C476807 for ; Mon, 7 Oct 2002 16:09:59 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id A204B476709 for ; Mon, 7 Oct 2002 16:09:53 -0400 (EDT) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1774389; Mon, 07 Oct 2002 13:08:27 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 13:12:21 -0700 X-Mailer: KMail [version 1.4] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210071312.21476.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/43 X-Sequence-Number: 60 Marie, > I pg_dumped the first database having performance problems and reloaded it > into a new database on the same server. The query ran normally when I > reloaded it. There is no difference in hardware, schema or anything else. That's a pretty brutal query.=20=20 From the comparison between the two queries, it looks like you have a lot o= f=20 discarded rows cluttering up the original database, just like I did.=20=20 What happens if you run VACUUM FULL VERBOSE on the Bad database? Does it= =20 report lots of rows taken up? --=20 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Mon Oct 7 16:15:39 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2771F4763F5 for ; Mon, 7 Oct 2002 16:15:39 -0400 (EDT) Received: from new-smtp2.ihug.com.au (new-smtp2.ihug.com.au [203.109.250.28]) by postgresql.org (Postfix) with ESMTP id 02D32476237 for ; Mon, 7 Oct 2002 16:15:38 -0400 (EDT) Received: from p393-tnt2.mel.ihug.com.au (postgresql.org) [203.173.165.139] by new-smtp2.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 17yeHx-0002cM-00; Tue, 08 Oct 2002 06:15:38 +1000 Message-ID: <3DA1EB67.7D717CB0@postgresql.org> Date: Tue, 08 Oct 2002 06:15:35 +1000 From: Justin Clift X-Mailer: Mozilla 4.79 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: marie.tuite@edisonaffiliates.com Cc: josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: sloooow query References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/44 X-Sequence-Number: 61 Hi Marie, Ok, not sure about the SQL side of things (got scared just *looking* at that query), but if this is at least a mostly-dedicated database server then you might want to bump up some of those buffer values. They look like defaults (except the max_connections and shared buffers). Initial thought is making just sort_mem = 8192 or so as a minimum (it could go a lot higher, but not sure of your memory configuration), as see if that makes a difference. Not sure the wal_files = 0 bit is good either. Haven't seen that set to 0 before. Might not assist with your present crisis, but am guessing PostgreSQL is chewing a lot of CPU and being slow in general with the present settings. :-) Regards and best wishes, Justin Clift "Marie G. Tuite" wrote: > > Here is a show all: > > Thanks, > > project-# ; > NOTICE: enable_seqscan is on > NOTICE: enable_indexscan is on > NOTICE: enable_tidscan is on > NOTICE: enable_sort is on > NOTICE: enable_nestloop is on > NOTICE: enable_mergejoin is on > NOTICE: enable_hashjoin is on > NOTICE: ksqo is off > NOTICE: geqo is on > NOTICE: tcpip_socket is on > NOTICE: ssl is off > NOTICE: fsync is on > NOTICE: silent_mode is off > NOTICE: log_connections is off > NOTICE: log_timestamp is off > NOTICE: log_pid is off > NOTICE: debug_print_query is off > NOTICE: debug_print_parse is off > NOTICE: debug_print_rewritten is off > NOTICE: debug_print_plan is off > NOTICE: debug_pretty_print is off > NOTICE: show_parser_stats is off > NOTICE: show_planner_stats is off > NOTICE: show_executor_stats is off > NOTICE: show_query_stats is off > NOTICE: stats_start_collector is on > NOTICE: stats_reset_on_server_start is on > NOTICE: stats_command_string is off > NOTICE: stats_row_level is off > NOTICE: stats_block_level is off > NOTICE: trace_notify is off > NOTICE: hostname_lookup is off > NOTICE: show_source_port is off > NOTICE: sql_inheritance is on > NOTICE: australian_timezones is off > NOTICE: fixbtree is on > NOTICE: password_encryption is off > NOTICE: transform_null_equals is off > NOTICE: geqo_threshold is 11 > NOTICE: geqo_pool_size is 0 > NOTICE: geqo_effort is 1 > NOTICE: geqo_generations is 0 > NOTICE: geqo_random_seed is -1 > NOTICE: deadlock_timeout is 1000 > NOTICE: syslog is 0 > NOTICE: max_connections is 64 > NOTICE: shared_buffers is 128 > NOTICE: port is 5432 > NOTICE: unix_socket_permissions is 511 > NOTICE: sort_mem is 1024 > NOTICE: vacuum_mem is 8192 > NOTICE: max_files_per_process is 1000 > NOTICE: debug_level is 0 > NOTICE: max_expr_depth is 10000 > NOTICE: max_fsm_relations is 100 > NOTICE: max_fsm_pages is 10000 > NOTICE: max_locks_per_transaction is 64 > NOTICE: authentication_timeout is 60 > NOTICE: pre_auth_delay is 0 > NOTICE: checkpoint_segments is 3 > NOTICE: checkpoint_timeout is 300 > NOTICE: wal_buffers is 8 > NOTICE: wal_files is 0 > NOTICE: wal_debug is 0 > NOTICE: commit_delay is 0 > NOTICE: commit_siblings is 5 > NOTICE: effective_cache_size is 1000 > NOTICE: random_page_cost is 4 > NOTICE: cpu_tuple_cost is 0.01 > NOTICE: cpu_index_tuple_cost is 0.001 > NOTICE: cpu_operator_cost is 0.0025 > NOTICE: geqo_selection_bias is 2 > NOTICE: default_transaction_isolation is read committed > NOTICE: dynamic_library_path is $libdir > NOTICE: krb_server_keyfile is FILE:/etc/pgsql/krb5.keytab > NOTICE: syslog_facility is LOCAL0 > NOTICE: syslog_ident is postgres > NOTICE: unix_socket_group is unset > NOTICE: unix_socket_directory is unset > NOTICE: virtual_host is unset > NOTICE: wal_sync_method is fdatasync > NOTICE: DateStyle is ISO with US (NonEuropean) conventions > NOTICE: Time zone is unset > NOTICE: TRANSACTION ISOLATION LEVEL is READ COMMITTED > NOTICE: Current client encoding is 'SQL_ASCII' > NOTICE: Current server encoding is 'SQL_ASCII' > NOTICE: Seed for random number generator is unavailable > SHOW VARIABLE > project=# > > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Justin Clift > > Sent: Monday, October 07, 2002 2:30 PM > > To: josh@agliodbs.com > > Cc: marie.tuite@edisonaffiliates.com; pgsql-performance@postgresql.org > > Subject: Re: [pgsql-performance] sloooow query > > > > > > Josh Berkus wrote: > > > > > > Marie, > > > > > > > I am experiencing slow db performance. I have vacuumed, > > analyzed, reindexed > > > > using the force option and performance remains the same - > > dog-slow :( If I > > > > drop and recreate the database, performance is normal, so > > this suggests a > > > > problem with the indexes? I also took a look at the > > postgresql.conf and all > > > > appears fine. There are many instances of the same database > > running on > > > > different servers and not all servers are experiencing the problem. > > > > > > Please post the following: > > > 1) A copy of the relevant portions of your database schema. > > > 2) The query that is running slowly. > > > 3) The results of running EXPLAIN on that query. > > > 4) Your PostgreSQL version and operating system > > > 5) Any other relevant information about your databases, such as > > the quantity > > > of inserts and deletes on the relevant tables. > > > > 6) And the sort_mem, shared_buffers, vacuum_mem, wal_buffers, and > > wal_files settings from your postgresql.conf file, if possible. > > > > :-) > > > > Regards and best wishes, > > > > Justin Clift > > > > > > > -- > > > -Josh Berkus > > > Aglio Database Solutions > > > San Francisco > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 5: Have you checked our extensive FAQ? > > > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > -- > > "My grandfather once told me that there are two kinds of people: those > > who work and those who take the credit. He told me to try to be in the > > first group; there was less competition there." > > - Indira Gandhi > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi From pgsql-performance-owner@postgresql.org Mon Oct 7 16:32:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 179F4475F66 for ; Mon, 7 Oct 2002 16:32:08 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.chi-il.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id 00576476823 for ; Mon, 7 Oct 2002 16:31:52 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 15:27:03 -0500 Reply-To: From: "Marie G. Tuite" To: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 15:34:11 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <200210071312.21476.josh@agliodbs.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/45 X-Sequence-Number: 62 > What happens if you run VACUUM FULL VERBOSE on the Bad database? Does it > report lots of rows taken up? I ran the vacuum for selected tables. It looks fine, I think, but I amn't always sure what I am reading in output. project=# vacuum full verbose classes; NOTICE: --Relation classes-- NOTICE: Pages 5: Changed 0, reaped 2, Empty 0, New 0; Tup 332: Vac 0, Keep/VTL 0/0, UnUsed 33, MinLen 93, MaxLen 117; Re-using: Free/Avail. Space 3020/2832; EndEmpty/Avail. Pages 0/1. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Index class_pkey: Pages 5; Tuples 332: Deleted 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Rel classes: Pages: 5 --> 5; Tuple(s) moved: 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: --Relation pg_toast_595650-- NOTICE: Pages 0: Changed 0, reaped 0, Empty 0, New 0; Tup 0: Vac 0, Keep/VTL 0/0, UnUsed 0, MinLen 0, MaxLen 0; Re-using: Free/Avail. Space 0/0; EndEmpty/Avail. Pages 0/0. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Index pg_toast_595650_idx: Pages 1; Tuples 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM project=# vacuum full verbose bm_publications; NOTICE: --Relation bm_publications-- NOTICE: Pages 2: Changed 0, reaped 1, Empty 0, New 0; Tup 284: Vac 0, Keep/VTL 0/0, UnUsed 6, MinLen 52, MaxLen 52; Re-using: Free/Avail. Space 416/416; EndEmpty/Avail. Pages 0/2. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Index bm_publications_pkey: Pages 4; Tuples 284: Deleted 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Rel bm_publications: Pages: 2 --> 2; Tuple(s) moved: 0. CPU 0.00s/0.01u sec elapsed 0.00 sec. VACUUM project=# vacuum full verbose user_common; NOTICE: --Relation user_common-- NOTICE: Pages 21: Changed 0, reaped 19, Empty 0, New 0; Tup 1045: Vac 0, Keep/VTL 0/0, UnUsed 103, MinLen 117, MaxLen 221; Re-using: Free/Avail. Space 4080/2968; EndEmpty/Avail. Pages 0/2. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Index user_common_pkey: Pages 20; Tuples 1045: Deleted 0. CPU 0.01s/0.00u sec elapsed 0.00 sec. NOTICE: Rel user_common: Pages: 21 --> 21; Tuple(s) moved: 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: --Relation pg_toast_474892-- NOTICE: Pages 0: Changed 0, reaped 0, Empty 0, New 0; Tup 0: Vac 0, Keep/VTL 0/0, UnUsed 0, MinLen 0, MaxLen 0; Re-using: Free/Avail. Space 0/0; EndEmpty/Avail. Pages 0/0. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Index pg_toast_474892_idx: Pages 1; Tuples 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM project=# vacuum full verbose bm_subscriptions_rlt; NOTICE: --Relation bm_subscriptions_rlt-- NOTICE: Pages 1: Changed 0, reaped 1, Empty 0, New 0; Tup 114: Vac 0, Keep/VTL 0/0, UnUsed 1, MinLen 57, MaxLen 57; Re-using: Free/Avail. Space 872/872; EndEmpty/Avail. Pages 0/1. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Index bm_subscriptions_rlt_pkey: Pages 2; Tuples 114: Deleted 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Rel bm_subscriptions_rlt: Pages: 1 --> 1; Tuple(s) moved: 0. CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM project=# From pgsql-performance-owner@postgresql.org Mon Oct 7 16:42:05 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E4AFE476856 for ; Mon, 7 Oct 2002 16:42:03 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id EE2E64767C5 for ; Mon, 7 Oct 2002 16:42:02 -0400 (EDT) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1774449; Mon, 07 Oct 2002 13:40:37 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 13:44:31 -0700 X-Mailer: KMail [version 1.4] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210071344.31233.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/46 X-Sequence-Number: 63 Marie, > I ran the vacuum for selected tables. It looks fine, I think, but I amn't > always sure what I am reading in output. So much for the easy answer. The reason I wanted to see a VACUUM FULL is= =20 that the query on the "bad" database is taking a long time to return even t= he=20 first row of many of its sub-parts. This is usually the result of not=20 running VACUUM FULL after a lot of deletions. However, your problem apparently is something else. Is is possible that= =20 there is some kind of disk access problem for the bad database copy? Is=20 there a difference in where its files are physically located? --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Oct 7 16:54:57 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8BB3D476352; Mon, 7 Oct 2002 16:54:54 -0400 (EDT) Received: from briar.mmrd.com (unknown [208.255.226.182]) by postgresql.org (Postfix) with ESMTP id 9E4F047624F; Mon, 7 Oct 2002 16:54:52 -0400 (EDT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by briar.mmrd.com (8.11.2/8.11.2) with ESMTP id g97LqWF18225; Mon, 7 Oct 2002 17:52:32 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id g97Ksrx14351; Mon, 7 Oct 2002 16:54:53 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id TK2FXNDK; Mon, 7 Oct 2002 16:54:51 -0400 Subject: Re: sloooow query From: Robert Treat To: Justin Clift Cc: marie.tuite@edisonaffiliates.com, josh@agliodbs.com, pgsql-performance@postgresql.org In-Reply-To: <3DA1EB67.7D717CB0@postgresql.org> References: <3DA1EB67.7D717CB0@postgresql.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 07 Oct 2002 16:50:27 -0400 Message-Id: <1034023827.3539.99.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/47 X-Sequence-Number: 64 On Mon, 2002-10-07 at 16:15, Justin Clift wrote: > Hi Marie, > > Not sure the wal_files = 0 bit is good either. Haven't seen that set to > 0 before. > This is the default value, and I don't recall anything in the docs that would suggest to change it. Also IIRC the back end will auto adjust the # of wal_files as needed in newer versions. Unless your seeing messages like "DEBUG: XLogWrite: new log file created - consider increasing WAL_FILES" I think you can leave this alone. Can you point me to something that says different? Robert Treat From pgsql-performance-owner@postgresql.org Mon Oct 7 16:56:45 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 788DF4765E4 for ; Mon, 7 Oct 2002 16:56:44 -0400 (EDT) Received: from briar.mmrd.com (unknown [208.255.226.182]) by postgresql.org (Postfix) with ESMTP id 6C41F476076 for ; Mon, 7 Oct 2002 16:56:41 -0400 (EDT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by briar.mmrd.com (8.11.2/8.11.2) with ESMTP id g97LsLF18426; Mon, 7 Oct 2002 17:54:21 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id g97Kugx14400; Mon, 7 Oct 2002 16:56:42 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id TK2FXNDX; Mon, 7 Oct 2002 16:56:41 -0400 Subject: Re: sloooow query From: Robert Treat To: marie.tuite@edisonaffiliates.com Cc: josh@agliodbs.com, pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 07 Oct 2002 16:52:16 -0400 Message-Id: <1034023937.3539.104.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/48 X-Sequence-Number: 65 On Mon, 2002-10-07 at 16:34, Marie G. Tuite wrote: > > What happens if you run VACUUM FULL VERBOSE on the Bad database? Does it > > report lots of rows taken up? > > I ran the vacuum for selected tables. It looks fine, I think, but I amn't > always sure what I am reading in output. > Is this vacuum being done on a system that is currently running slow, or was this system recently dropped/reloaded? Robert Treat From pgsql-performance-owner@postgresql.org Mon Oct 7 16:57:49 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3FA7D476955 for ; Mon, 7 Oct 2002 16:57:49 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 5E11647694A for ; Mon, 7 Oct 2002 16:57:48 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g97KvehR026240; Mon, 7 Oct 2002 16:57:40 -0400 (EDT) To: marie.tuite@edisonaffiliates.com Cc: josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: sloooow query In-reply-to: References: Comments: In-reply-to "Marie G. Tuite" message dated "Mon, 07 Oct 2002 14:49:16 -0500" Date: Mon, 07 Oct 2002 16:57:40 -0400 Message-ID: <26239.1034024260@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/49 X-Sequence-Number: 66 "Marie G. Tuite" writes: > I pg_dumped the first database having performance problems and reloaded it > into a new database on the same server. The query ran normally when I > reloaded it. There is no difference in hardware, schema or anything else. Have you done an ANALYZE or VACUUM ANALYZE in either database? The statistics the planner is working from seem to be quite different in the two plans. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Oct 7 17:01:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 37C42476543 for ; Mon, 7 Oct 2002 17:01:02 -0400 (EDT) Received: from new-smtp2.ihug.com.au (new-smtp2.ihug.com.au [203.109.250.28]) by postgresql.org (Postfix) with ESMTP id 7E0C04764E0 for ; Mon, 7 Oct 2002 17:01:01 -0400 (EDT) Received: from p393-tnt2.mel.ihug.com.au (postgresql.org) [203.173.165.139] by new-smtp2.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 17yezr-00068l-00; Tue, 08 Oct 2002 07:01:00 +1000 Message-ID: <3DA1F609.B2570F2F@postgresql.org> Date: Tue, 08 Oct 2002 07:00:57 +1000 From: Justin Clift X-Mailer: Mozilla 4.79 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Robert Treat Cc: marie.tuite@edisonaffiliates.com, josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: sloooow query References: <3DA1EB67.7D717CB0@postgresql.org> <1034023827.3539.99.camel@camel> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/50 X-Sequence-Number: 67 Robert Treat wrote: > > On Mon, 2002-10-07 at 16:15, Justin Clift wrote: > > Hi Marie, > > > > Not sure the wal_files = 0 bit is good either. Haven't seen that set to > > 0 before. > > > > This is the default value, and I don't recall anything in the docs that > would suggest to change it. Also IIRC the back end will auto adjust the > # of wal_files as needed in newer versions. Unless your seeing messages > like "DEBUG: XLogWrite: new log file created - consider increasing > WAL_FILES" I think you can leave this alone. Can you point me to > something that says different? Ahh... that makes sense. Have been doing almost nothing else recently except for setting up new PostgreSQL databases, loading in data, then doing load testing for things. Have totally become so used to having wal_files being other than 0 that it didn't even register that this is the default. ;-> Sorry about that, and thanks for the heads up. :-) Regards and best wishes, Justin Clift > Robert Treat -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi From pgsql-performance-owner@postgresql.org Mon Oct 7 18:01:52 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4571D476543 for ; Mon, 7 Oct 2002 18:01:50 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.phx-az.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id 2CCC8476237 for ; Mon, 7 Oct 2002 18:01:47 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 16:57:01 -0500 Reply-To: From: "Marie G. Tuite" To: "Tom Lane" Cc: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 17:04:09 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <26239.1034024260@sss.pgh.pa.us> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/51 X-Sequence-Number: 68 I have analyzed, vacuumed and reindexed. > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Monday, October 07, 2002 3:58 PM > To: marie.tuite@edisonaffiliates.com > Cc: josh@agliodbs.com; pgsql-performance@postgresql.org > Subject: Re: [pgsql-performance] sloooow query > > > "Marie G. Tuite" writes: > > I pg_dumped the first database having performance problems and > reloaded it > > into a new database on the same server. The query ran normally when I > > reloaded it. There is no difference in hardware, schema or > anything else. > > Have you done an ANALYZE or VACUUM ANALYZE in either database? The > statistics the planner is working from seem to be quite different > in the two plans. > > regards, tom lane > From pgsql-performance-owner@postgresql.org Mon Oct 7 18:03:49 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 380FA475DD0 for ; Mon, 7 Oct 2002 18:03:49 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.phx-az.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id 92829475BD7 for ; Mon, 7 Oct 2002 18:03:48 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 16:57:01 -0500 Reply-To: From: "Marie G. Tuite" To: "Robert Treat" Cc: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 17:04:09 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1034023937.3539.104.camel@camel> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/53 X-Sequence-Number: 70 > Is this vacuum being done on a system that is currently running slow, or > was this system recently dropped/reloaded? Currently slow. From pgsql-performance-owner@postgresql.org Mon Oct 7 18:03:22 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3DB1E47609B for ; Mon, 7 Oct 2002 18:03:22 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.phx-az.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id 9476C475DAD for ; Mon, 7 Oct 2002 18:03:21 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 16:58:36 -0500 Reply-To: From: "Marie G. Tuite" To: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 17:05:41 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <200210071344.31233.josh@agliodbs.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/52 X-Sequence-Number: 69 > However, your problem apparently is something else. Is is possible that > there is some kind of disk access problem for the bad database copy? Is > there a difference in where its files are physically located? Both are in default storage - /var/lib/pgsql/data. From pgsql-performance-owner@postgresql.org Mon Oct 7 18:07:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0404147683C for ; Mon, 7 Oct 2002 18:07:27 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.phx-az.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id 30174476500 for ; Mon, 7 Oct 2002 18:07:26 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 17:02:38 -0500 Reply-To: From: "Marie G. Tuite" To: "Robert Treat" Cc: , Subject: Re: sloooow query Date: Mon, 7 Oct 2002 17:09:46 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1034023937.3539.104.camel@camel> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/54 X-Sequence-Number: 71 > Is this vacuum being done on a system that is currently running slow, or > was this system recently dropped/reloaded? Currently slow. From pgsql-performance-owner@postgresql.org Mon Oct 7 18:10:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AADB44761F8 for ; Mon, 7 Oct 2002 18:10:24 -0400 (EDT) Received: from edisonaffiliates.com (w205.z208176060.phx-az.dsl.cnc.net [208.176.60.205]) by postgresql.org (Postfix) with SMTP id 84541476048 for ; Mon, 7 Oct 2002 18:10:22 -0400 (EDT) Received: from redhen ([12.32.94.66]) by edisonaffiliates.com ; Mon, 07 Oct 2002 17:05:33 -0500 Reply-To: From: "Marie G. Tuite" To: "Pgsql-Performance@Postgresql. Org" Subject: Re: sloooow query Date: Mon, 7 Oct 2002 17:12:41 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <26239.1034024260@sss.pgh.pa.us> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/55 X-Sequence-Number: 72 > Have you done an ANALYZE or VACUUM ANALYZE in either database? The > statistics the planner is working from seem to be quite different > in the two plans. I have vacuumed, analysed and reindexed. From pgsql-general-owner@postgresql.org Mon Oct 7 20:03:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9AF96475E77; Mon, 7 Oct 2002 20:03:22 -0400 (EDT) Received: from svana.org (t1-1-076.dialup.apex.net.au [203.20.62.76]) by postgresql.org (Postfix) with ESMTP id BF37D475DAD; Mon, 7 Oct 2002 20:03:20 -0400 (EDT) Received: from kleptog by svana.org with local (Exim 3.35 #1 (Debian)) id 17yhq8-0007cg-00; Tue, 08 Oct 2002 10:03:08 +1000 Date: Tue, 8 Oct 2002 10:03:08 +1000 From: Martijn van Oosterhout To: "Marie G. Tuite" Cc: "Pgsql-General@Postgresql. Org" , pgsql-performance@postgresql.org Subject: Re: sloooow query Message-ID: <20021008000308.GA28930@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: "Marie G. Tuite" , "Pgsql-General@Postgresql. Org" , pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/413 X-Sequence-Number: 31411 On Mon, Oct 07, 2002 at 02:22:09PM -0500, Marie G. Tuite wrote: > Hello all, > > I am experiencing slow db performance. I have vacuumed, analyzed, reindexed > using the force option and performance remains the same - dog-slow :( If I > drop and recreate the database, performance is normal, so this suggests a > problem with the indexes? I also took a look at the postgresql.conf and all > appears fine. There are many instances of the same database running on > different servers and not all servers are experiencing the problem. We need more details if you wish to receive useful answers. Query/EXPLAIN output/schema, etc -- Martijn van Oosterhout http://svana.org/kleptog/ > There are 10 kinds of people in the world, those that can do binary > arithmetic and those that can't. From pgsql-general-owner@postgresql.org Tue Oct 8 01:43:47 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 351144760FA for ; Tue, 8 Oct 2002 01:43:46 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 76CB4475EF0 for ; Tue, 8 Oct 2002 01:43:43 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g985jGF22144 for ; Tue, 8 Oct 2002 11:15:16 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g985jGv22134; Tue, 8 Oct 2002 11:15:16 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Date: Tue, 08 Oct 2002 11:14:11 +0530 MIME-Version: 1.0 Subject: Re: [pgsql-performance] Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA2BE03.3674.13CF7DD1@localhost> References: <3DA1E50F.4394.107FF85D@localhost> In-reply-to: <23897.1034004117@sss.pgh.pa.us> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/418 X-Sequence-Number: 31416 On 7 Oct 2002 at 11:21, Tom Lane wrote: > "Shridhar Daithankar" writes: > > I say if it's a char field, there should be no indicator of length as > > it's not required. Just store those many characters straight ahead.. > > Your assumption fails when considering UNICODE or other multibyte > character encodings. Correct but is it possible to have real char string when database is not unicode or when locale defines size of char, to be exact? In my case varchar does not make sense as all strings are guaranteed to be of defined length. While the argument you have put is correct, it's causing a disk space leak, to say so. Bye Shridhar -- Boucher's Observation: He who blows his own horn always plays the music several octaves higher than originally written. From pgsql-general-owner@postgresql.org Tue Oct 8 03:21:04 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 21BE5475DAD; Tue, 8 Oct 2002 03:21:01 -0400 (EDT) Received: from svana.org (t1-1-076.dialup.apex.net.au [203.20.62.76]) by postgresql.org (Postfix) with ESMTP id 50161475D93; Tue, 8 Oct 2002 03:21:00 -0400 (EDT) Received: from kleptog by svana.org with local (Exim 3.35 #1 (Debian)) id 17yoff-0000MV-00; Tue, 08 Oct 2002 17:20:47 +1000 Date: Tue, 8 Oct 2002 17:20:47 +1000 From: Martijn van Oosterhout To: Shridhar Daithankar Cc: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: [pgsql-performance] Large databases, performance Message-ID: <20021008072047.GB558@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: Shridhar Daithankar , pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org References: <3DA1E50F.4394.107FF85D@localhost> <3DA2BE03.3674.13CF7DD1@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DA2BE03.3674.13CF7DD1@localhost> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/427 X-Sequence-Number: 31425 On Tue, Oct 08, 2002 at 11:14:11AM +0530, Shridhar Daithankar wrote: > On 7 Oct 2002 at 11:21, Tom Lane wrote: > > > "Shridhar Daithankar" writes: > > > I say if it's a char field, there should be no indicator of length as > > > it's not required. Just store those many characters straight ahead.. > > > > Your assumption fails when considering UNICODE or other multibyte > > character encodings. > > Correct but is it possible to have real char string when database is not > unicode or when locale defines size of char, to be exact? > > In my case varchar does not make sense as all strings are guaranteed to be of > defined length. While the argument you have put is correct, it's causing a disk > space leak, to say so. Well, maybe. But since 7.1 or so char() and varchar() simply became text with some length restrictions. This was one of the reasons. It also simplified a lot of code. -- Martijn van Oosterhout http://svana.org/kleptog/ > There are 10 kinds of people in the world, those that can do binary > arithmetic and those that can't. From pgsql-general-owner@postgresql.org Tue Oct 8 09:33:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 34D0C476993 for ; Tue, 8 Oct 2002 09:33:54 -0400 (EDT) Received: from smtp014.mail.yahoo.com (smtp014.mail.yahoo.com [216.136.173.58]) by postgresql.org (Postfix) with SMTP id 69EC3476117 for ; Tue, 8 Oct 2002 09:33:03 -0400 (EDT) Received: from psc.progress.com (HELO Yahoo.com) (janwieck@192.233.92.200 with plain) by smtp.mail.vip.sc5.yahoo.com with SMTP; 8 Oct 2002 13:32:55 -0000 Message-ID: <3DA2DE82.1AC84934@Yahoo.com> Date: Tue, 08 Oct 2002 09:32:50 -0400 From: Jan Wieck Organization: Home X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,ru MIME-Version: 1.0 To: Tom Lane Cc: David Blood , pgsql-general@postgresql.org Subject: Re: Pinning a table into memory References: <03a301c26bc5$a799a970$1f00a8c0@redwood> <25545.1033757267@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/445 X-Sequence-Number: 31443 Tom Lane wrote: > > "David Blood" writes: > > In Oracle you can Pin large objects into memory to prevent frequent > > reloads. Is there anyway to do this with Postgres? > > I can never understand why people think this would be a good idea. > If you're hitting a table frequently, it will stay in memory anyway > (either in Postgres shared buffers or kernel disk cache). If you're > not hitting it frequently enough to keep it swapped in, then whatever > is getting swapped in instead is probably a better candidate to be > occupying the space. As I understand it, he's looking for a mechanism to prevent a single sequential scan on a table, larger than the buffer cache, to kick out everything else at once. But I agree with you that pinning other objects is just mucking with the symptoms instead of curing the desease. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Tue Oct 8 09:53:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2575C476E64 for ; Tue, 8 Oct 2002 09:53:16 -0400 (EDT) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by postgresql.org (Postfix) with ESMTP id 1078747651A for ; Tue, 8 Oct 2002 09:51:07 -0400 (EDT) Received: from localhost.localdomain ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021008135106.FWLY1315.lakemtao04.cox.net@localhost.localdomain> for ; Tue, 8 Oct 2002 09:51:06 -0400 Subject: Re: [GENERAL] Large databases, performance From: Ron Johnson To: pgsql-performance@postgresql.org In-Reply-To: <20021008072047.GB558@svana.org> References: <3DA1E50F.4394.107FF85D@localhost> <3DA2BE03.3674.13CF7DD1@localhost> <20021008072047.GB558@svana.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 08 Oct 2002 08:50:52 -0500 Message-Id: <1034085052.1094.14.camel@haggis> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/59 X-Sequence-Number: 76 On Tue, 2002-10-08 at 02:20, Martijn van Oosterhout wrote: > On Tue, Oct 08, 2002 at 11:14:11AM +0530, Shridhar Daithankar wrote: > > On 7 Oct 2002 at 11:21, Tom Lane wrote: > > > > > "Shridhar Daithankar" writes: > > > > I say if it's a char field, there should be no indicator of length as > > > > it's not required. Just store those many characters straight ahead.. > > > > > > Your assumption fails when considering UNICODE or other multibyte > > > character encodings. > > > > Correct but is it possible to have real char string when database is not > > unicode or when locale defines size of char, to be exact? > > > > In my case varchar does not make sense as all strings are guaranteed to be of > > defined length. While the argument you have put is correct, it's causing a disk > > space leak, to say so. Not only that, but you get INSERT, UPDATE, DELETE and SELECT performance gains with fixed length records, since you don't get fragmentation. For example: TABLE T F1 INTEGER; F2 VARCHAR(200) INSERT INTO T VALUES (1, 'FOO BAR'); INSERT INTO T VALUES (2, 'SNAFU'); Next, UPDATE T SET F2 = 'WIGGLE WAGGLE WUMPERSTUMPER' WHERE F1 = 1; Unless there is a big gap on disk between the 2 inserted records, postgresql must then look somewhere else for space to put the new version of T WHERE F1 = 1. With fixed-length records, you know exactly where you can put the new value of F2, thus minimizing IO. > Well, maybe. But since 7.1 or so char() and varchar() simply became text > with some length restrictions. This was one of the reasons. It also > simplified a lot of code. How much simpler can you get than fixed-length records? Of course, then there are 2 code paths, 1 for fixed length, and 1 for variable length. -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Oct 8 10:38:00 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D658F4760AA for ; Tue, 8 Oct 2002 10:37:59 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 14D70475BD7 for ; Tue, 8 Oct 2002 10:37:59 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g98Ec2hR001929; Tue, 8 Oct 2002 10:38:02 -0400 (EDT) To: Ron Johnson Cc: pgsql-performance@postgresql.org Subject: Re: [GENERAL] Large databases, performance In-reply-to: <1034085052.1094.14.camel@haggis> References: <3DA1E50F.4394.107FF85D@localhost> <3DA2BE03.3674.13CF7DD1@localhost> <20021008072047.GB558@svana.org> <1034085052.1094.14.camel@haggis> Comments: In-reply-to Ron Johnson message dated "08 Oct 2002 08:50:52 -0500" Date: Tue, 08 Oct 2002 10:38:02 -0400 Message-ID: <1928.1034087882@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/60 X-Sequence-Number: 77 Ron Johnson writes: > Not only that, but you get INSERT, UPDATE, DELETE and SELECT performance > gains with fixed length records, since you don't get fragmentation. That argument loses a lot of its force when you consider that Postgres uses non-overwriting storage management. We never do an UPDATE in-place anyway, and so it matters little whether the updated record is the same size as the original. >> Well, maybe. But since 7.1 or so char() and varchar() simply became text >> with some length restrictions. This was one of the reasons. It also >> simplified a lot of code. > How much simpler can you get than fixed-length records? It's not simpler: it's more complicated, because you need an additional input item to figure out the size of any given column in a record. Making sure that that info is available every place it's needed is one of the costs of supporting a feature like this. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Oct 8 10:41:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D1577476950 for ; Tue, 8 Oct 2002 10:41:19 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id B1881476992 for ; Tue, 8 Oct 2002 10:41:14 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g98EgrE13773 for ; Tue, 8 Oct 2002 20:12:53 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g98Egrv13768 for ; Tue, 8 Oct 2002 20:12:53 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Tue, 08 Oct 2002 20:11:47 +0530 MIME-Version: 1.0 Subject: Re: [GENERAL] Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA33C03.31407.15BBAE9C@localhost> References: <1034085052.1094.14.camel@haggis> In-reply-to: <1928.1034087882@sss.pgh.pa.us> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/61 X-Sequence-Number: 78 On 8 Oct 2002 at 10:38, Tom Lane wrote: > Ron Johnson writes: > It's not simpler: it's more complicated, because you need an additional > input item to figure out the size of any given column in a record. > Making sure that that info is available every place it's needed is one > of the costs of supporting a feature like this. I understand. Can we put this in say page header instead of tuple header. While all the arguments you have put are really good, the stellar redundancy certainly can do with a mid-way solution. Just a thought.. Bye Shridhar -- bit, n: A unit of measure applied to color. Twenty-four-bit color refers to expensive $3 color as opposed to the cheaper 25 cent, or two-bit, color that use to be available a few years ago. From pgsql-performance-owner@postgresql.org Tue Oct 8 11:17:06 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 410DA475F84 for ; Tue, 8 Oct 2002 11:17:05 -0400 (EDT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by postgresql.org (Postfix) with ESMTP id 95A27475F32 for ; Tue, 8 Oct 2002 11:17:04 -0400 (EDT) Received: from localhost.localdomain ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021008151709.OQAG1310.lakemtao01.cox.net@localhost.localdomain> for ; Tue, 8 Oct 2002 11:17:09 -0400 Subject: Re: [GENERAL] Large databases, performance From: Ron Johnson To: pgsql-performance@postgresql.org In-Reply-To: <1928.1034087882@sss.pgh.pa.us> References: <3DA1E50F.4394.107FF85D@localhost> <3DA2BE03.3674.13CF7DD1@localhost> <20021008072047.GB558@svana.org> <1034085052.1094.14.camel@haggis> <1928.1034087882@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 08 Oct 2002 10:16:55 -0500 Message-Id: <1034090215.1094.42.camel@haggis> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/62 X-Sequence-Number: 79 On Tue, 2002-10-08 at 09:38, Tom Lane wrote: > Ron Johnson writes: > > Not only that, but you get INSERT, UPDATE, DELETE and SELECT performance > > gains with fixed length records, since you don't get fragmentation. > > That argument loses a lot of its force when you consider that Postgres > uses non-overwriting storage management. We never do an UPDATE in-place > anyway, and so it matters little whether the updated record is the same > size as the original. Must you update any relative indexes, in order to point to the new location of the record? > >> Well, maybe. But since 7.1 or so char() and varchar() simply became text > >> with some length restrictions. This was one of the reasons. It also > >> simplified a lot of code. > > > How much simpler can you get than fixed-length records? > > It's not simpler: it's more complicated, because you need an additional > input item to figure out the size of any given column in a record. With fixed-length, why? From the metadata, you can compute the intra- record offsets. That's how it works with the commercial RDBMS that I use at work. On that system, even variable-length records don't need record-size fields. Any repeating text (more that ~4 chars) is replaced with run-length encoding. This includes the phantom spaces at the end of the field. > Making sure that that info is available every place it's needed is one > of the costs of supporting a feature like this. -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Oct 8 11:35:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 58BB9476773 for ; Tue, 8 Oct 2002 11:35:11 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id B7D584766E6 for ; Tue, 8 Oct 2002 11:35:10 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1775407; Tue, 08 Oct 2002 08:33:53 -0700 From: "Josh Berkus" Subject: Re: CHAR, VARCHAR, TEXT (Was Large Databases) To: Ron Johnson , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 08 Oct 2002 08:33:53 -0700 Message-ID: In-Reply-To: <1034090215.1094.42.camel@haggis> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/63 X-Sequence-Number: 80 Ron, Shridhar, Maybe I missed something on this thread, but can either of you give me an example of a real database where the PostgreSQL approach of "all strings are TEXT" versus the more traditional CHAR implementation have resulted in measurable performance loss? Otherwise, this discussion is rather academic ... -Josh Berkus From pgsql-performance-owner@postgresql.org Tue Oct 8 11:51:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CD04C47627C for ; Tue, 8 Oct 2002 11:51:08 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 218004761C2 for ; Tue, 8 Oct 2002 11:51:08 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g98FpChR002503; Tue, 8 Oct 2002 11:51:12 -0400 (EDT) To: Ron Johnson Cc: pgsql-performance@postgresql.org Subject: Re: [GENERAL] Large databases, performance In-reply-to: <1034090215.1094.42.camel@haggis> References: <3DA1E50F.4394.107FF85D@localhost> <3DA2BE03.3674.13CF7DD1@localhost> <20021008072047.GB558@svana.org> <1034085052.1094.14.camel@haggis> <1928.1034087882@sss.pgh.pa.us> <1034090215.1094.42.camel@haggis> Comments: In-reply-to Ron Johnson message dated "08 Oct 2002 10:16:55 -0500" Date: Tue, 08 Oct 2002 11:51:12 -0400 Message-ID: <2502.1034092272@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/64 X-Sequence-Number: 81 Ron Johnson writes: > On Tue, 2002-10-08 at 09:38, Tom Lane wrote: >> That argument loses a lot of its force when you consider that Postgres >> uses non-overwriting storage management. We never do an UPDATE in-place >> anyway, and so it matters little whether the updated record is the same >> size as the original. > Must you update any relative indexes, in order to point to the > new location of the record? We make new index entries for the new record, yes. Both the old and new records must be indexed (until one or the other is garbage-collected by VACUUM) so that transactions can find whichever version they are supposed to be able to see according to the tuple visibility rules. >> It's not simpler: it's more complicated, because you need an additional >> input item to figure out the size of any given column in a record. > With fixed-length, why? From the metadata, you can compute the intra- > record offsets. Sure, but you need an additional item of metadata than you otherwise would (this is atttypmod, in Postgres terms). I'm not certain that the typmod is available everyplace that would need to be able to figure out the physical width of a column. > On that system, even variable-length records don't need record-size > fields. Any repeating text (more that ~4 chars) is replaced with > run-length encoding. This includes the phantom spaces at the end > of the field. Interesting that you should bring that up in the context of an argument for supporting fixed-width fields ;-). Doesn't any form of data compression bring you right back into variable-width land? Postgres' approach to data compression is that it's done per-field, and only on variable-width fields. We steal a couple of bits from the length word to allow flagging of compressed and out-of-line values. If we were to make CHAR(n) fixed-width then it would lose the ability to participate in either compression or out-of-line storage. Between that and the multibyte-encoding issue, I think it's very difficult to make a case that the general-purpose CHAR(n) type should be implemented as fixed-width. If someone has a specialized application where they need a restricted fixed-width string type, it's not that hard to make a user-defined type that supports only a single column width (and thereby gets around the typmod issue). So I'm satisfied with saying "define your own type if you want this". regards, tom lane From pgsql-performance-owner@postgresql.org Tue Oct 8 13:42:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 98F67475AFA for ; Tue, 8 Oct 2002 13:42:35 -0400 (EDT) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by postgresql.org (Postfix) with ESMTP id 0B5DE4759BD for ; Tue, 8 Oct 2002 13:42:35 -0400 (EDT) Received: from localhost.localdomain ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021008174235.DSTC12192.lakemtao02.cox.net@localhost.localdomain> for ; Tue, 8 Oct 2002 13:42:35 -0400 Subject: Re: CHAR, VARCHAR, TEXT (Was Large Databases) From: Ron Johnson To: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 08 Oct 2002 12:42:20 -0500 Message-Id: <1034098940.1336.39.camel@haggis> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/65 X-Sequence-Number: 82 On Tue, 2002-10-08 at 10:33, Josh Berkus wrote: > Ron, Shridhar, > > Maybe I missed something on this thread, but can either of you give me > an example of a real database where the PostgreSQL approach of "all > strings are TEXT" versus the more traditional CHAR implementation have > resulted in measurable performance loss? ?????? > Otherwise, this discussion is rather academic ... -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Oct 8 18:45:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 60DEC4760FA for ; Tue, 8 Oct 2002 18:45:35 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id B3852475F82 for ; Tue, 8 Oct 2002 18:45:34 -0400 (EDT) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1776173; Tue, 08 Oct 2002 15:44:16 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Ron Johnson , pgsql-performance@postgresql.org Subject: Re: CHAR, VARCHAR, TEXT (Was Large Databases) Date: Tue, 8 Oct 2002 15:44:36 -0700 X-Mailer: KMail [version 1.4] References: <1034098940.1336.39.camel@haggis> In-Reply-To: <1034098940.1336.39.camel@haggis> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210081544.36139.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/66 X-Sequence-Number: 83 Ron, > > Maybe I missed something on this thread, but can either of you give me > > an example of a real database where the PostgreSQL approach of "all > > strings are TEXT" versus the more traditional CHAR implementation have > > resulted in measurable performance loss? > > ?????? In other words, if it ain't broke, don't fix it. --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco From pgsql-general-owner@postgresql.org Tue Oct 8 19:00:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4ABB1476390; Tue, 8 Oct 2002 19:00:23 -0400 (EDT) Received: from svana.org (t1-1-076.dialup.apex.net.au [203.20.62.76]) by postgresql.org (Postfix) with ESMTP id E5DDC47627C; Tue, 8 Oct 2002 19:00:21 -0400 (EDT) Received: from kleptog by svana.org with local (Exim 3.35 #1 (Debian)) id 17z3C3-0002Gs-00; Wed, 09 Oct 2002 08:51:11 +1000 Date: Wed, 9 Oct 2002 08:51:11 +1000 From: Martijn van Oosterhout To: Zeugswetter Andreas SB SD Cc: Manfred Koizar , shridhar_daithankar@persistent.co.in, pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: [HACKERS] Large databases, performance Message-ID: <20021008225111.GA8663@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: Zeugswetter Andreas SB SD , Manfred Koizar , shridhar_daithankar@persistent.co.in, pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org References: <46C15C39FEB2C44BA555E356FBCD6FA4887A5A@m0114.s-mxs.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46C15C39FEB2C44BA555E356FBCD6FA4887A5A@m0114.s-mxs.net> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/473 X-Sequence-Number: 31471 On Mon, Oct 07, 2002 at 05:42:12PM +0200, Zeugswetter Andreas SB SD wrote: > > Hackers, do you think it's possible to hack together a quick and dirty > > patch, so that string length is represented by one byte? IOW can a > > database be built that doesn't contain any char/varchar/text value > > longer than 255 characters in the catalog? > > Since he is only using fixchar how about doing a fixchar implemetation, that > does not store length at all ? It is the same for every row anyways ! Remember that in Unicode, 1 char != 1 byte. In fact, any encoding that's not Latin will have a problem. I guess you could put a warning on it: not for use for asian character sets. So what do you do if someone tries to insert such a string anyway? Perhaps a better approach is to vary the number of bytes used for the length. So one byte for lengths < 64, two bytes for lengths < 16384. Unfortunatly, two bits in the length are already used (IIRC) for other things making it a bit more tricky. -- Martijn van Oosterhout http://svana.org/kleptog/ > There are 10 kinds of people in the world, those that can do binary > arithmetic and those that can't. From pgsql-performance-owner@postgresql.org Tue Oct 8 19:37:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1477F475B33 for ; Tue, 8 Oct 2002 19:37:40 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 1E8C3476541 for ; Tue, 8 Oct 2002 19:37:39 -0400 (EDT) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1776247; Tue, 08 Oct 2002 16:36:21 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Ron Johnson , pgsql-performance@postgresql.org Subject: Re: CHAR, VARCHAR, TEXT (Was Large Databases) Date: Tue, 8 Oct 2002 16:36:40 -0700 X-Mailer: KMail [version 1.4] References: <200210081544.36139.josh@agliodbs.com> <1034119771.1365.154.camel@haggis> In-Reply-To: <1034119771.1365.154.camel@haggis> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210081636.40713.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/68 X-Sequence-Number: 85 Ron, > > > > Maybe I missed something on this thread, but can either of you give > > > > me an example of a real database where the PostgreSQL approach of > > > > "all strings are TEXT" versus the more traditional CHAR > > > > implementation have resulted in measurable performance loss? > > > > > > ?????? > > > > In other words, if it ain't broke, don't fix it. > > Well, does Really Slow Performance qualify as "broke"? That's what I was asking. Can you explain where your slow performance is= =20 attibutable to the CHAR implementation issues? I missed that, if it was= =20 explained earlier in the thread. --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Oct 8 23:47:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9173B475FC5 for ; Tue, 8 Oct 2002 23:47:26 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id F320A475FB8 for ; Tue, 8 Oct 2002 23:47:25 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1776486 for ; Tue, 08 Oct 2002 20:46:12 -0700 From: "Josh Berkus" Subject: What does this tell me? To: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 08 Oct 2002 20:46:12 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/69 X-Sequence-Number: 86 Folks, I'm still having trouble with my massive data transformation procedures taking forever to finish. Particularly, many of them will get about 1/2 way through, and then I will start seeing this in the log: 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000E4 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000E5 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000E6 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000E7 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000E8 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000E9 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000EA 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000EB 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000EC 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000ED 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000EE 2002-10-08 20:37:13 DEBUG: recycled transaction log file 0000000A000000EF 2002-10-08 20:37:13 DEBUG: reaping dead processes 2002-10-08 20:37:13 DEBUG: child process (pid 15270) exited with exit code 0 ... repeat ad nauseum. The problem is, each "recycle transaction log ... reaping dead child process" cycle takes about 4-7 minutes ... meaning that the procedure can take up to 1/2 hour to finish, and sometimes not finish at all. Obviously, the system is telling me that it is running out of resources somehow. But I'm at my wit's end to figure out what resources, exactly. Suggestions? -Josh Berkus From pgsql-performance-owner@postgresql.org Tue Oct 8 23:49:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4EE2D475E40 for ; Tue, 8 Oct 2002 23:49:45 -0400 (EDT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 60949475DAD for ; Tue, 8 Oct 2002 23:49:43 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g993nab27932; Tue, 8 Oct 2002 23:49:36 -0400 (EDT) From: Bruce Momjian Message-Id: <200210090349.g993nab27932@candle.pha.pa.us> Subject: Re: What does this tell me? In-Reply-To: To: Josh Berkus Date: Tue, 8 Oct 2002 23:49:36 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/70 X-Sequence-Number: 87 I think all it means is that is doesn't need some of the pg_clog files and is reusing them, basically meaning you are pushing through lots of transactions. I don't see it as a problem. --------------------------------------------------------------------------- Josh Berkus wrote: > Folks, > > I'm still having trouble with my massive data transformation procedures > taking forever to finish. Particularly, many of them will get about > 1/2 way through, and then I will start seeing this in the log: > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E4 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E5 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E6 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E7 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E8 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E9 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EA > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EB > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EC > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000ED > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EE > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EF > 2002-10-08 20:37:13 DEBUG: reaping dead processes > 2002-10-08 20:37:13 DEBUG: child process (pid 15270) exited with exit > code 0 > > ... repeat ad nauseum. The problem is, each "recycle transaction log > ... reaping dead child process" cycle takes about 4-7 minutes ... > meaning that the procedure can take up to 1/2 hour to finish, and > sometimes not finish at all. > > Obviously, the system is telling me that it is running out of resources > somehow. But I'm at my wit's end to figure out what resources, > exactly. Suggestions? > > -Josh Berkus > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Tue Oct 8 23:50:50 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DB191475E60 for ; Tue, 8 Oct 2002 23:50:49 -0400 (EDT) Received: from mailhost.nxad.com (lan.ext.nxad.com [66.250.180.254]) by postgresql.org (Postfix) with ESMTP id 4D1FD475B33 for ; Tue, 8 Oct 2002 23:50:49 -0400 (EDT) Received: from perrin.int.nxad.com (perrin.int.nxad.com [192.168.1.251]) by mailhost.nxad.com (Postfix) with ESMTP id 4C618212E00; Tue, 8 Oct 2002 20:50:44 -0700 (PDT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id AB90520F02; Tue, 8 Oct 2002 20:50:43 -0700 (PDT) Date: Tue, 8 Oct 2002 20:50:43 -0700 From: Sean Chittenden To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: What does this tell me? Message-ID: <20021009035043.GC34365@perrin.int.nxad.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 6CEB 1B06 BFD3 70F6 95BE 7E4D 8E85 2E0A 5F5B 3ECB X-Web-Homepage: http://sean.chittenden.org/ X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/71 X-Sequence-Number: 88 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E4 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E5 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E6 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E7 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E8 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000E9 > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EA > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EB > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EC > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000ED > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EE > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > 0000000A000000EF > 2002-10-08 20:37:13 DEBUG: reaping dead processes > 2002-10-08 20:37:13 DEBUG: child process (pid 15270) exited with exit > code 0 > > ... repeat ad nauseum. The problem is, each "recycle transaction > log ... reaping dead child process" cycle takes about 4-7 minutes > ... meaning that the procedure can take up to 1/2 hour to finish, > and sometimes not finish at all. > > Obviously, the system is telling me that it is running out of > resources somehow. But I'm at my wit's end to figure out what > resources, exactly. Suggestions? You're running out of WAL log space, iirc. Increase the number of WAL logs available and you should be okay. If you're experiencing this halfway through, I'd increase the size by 50%, say maybe 60-70% for good measure. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Tue Oct 8 23:55:37 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 250B64761BF for ; Tue, 8 Oct 2002 23:55:37 -0400 (EDT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 31650476154 for ; Tue, 8 Oct 2002 23:55:35 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g993tAU02565; Tue, 8 Oct 2002 23:55:10 -0400 (EDT) From: Bruce Momjian Message-Id: <200210090355.g993tAU02565@candle.pha.pa.us> Subject: Re: What does this tell me? In-Reply-To: <20021009035043.GC34365@perrin.int.nxad.com> To: Sean Chittenden Date: Tue, 8 Oct 2002 23:55:10 -0400 (EDT) Cc: Josh Berkus , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/72 X-Sequence-Number: 89 Sean Chittenden wrote: > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000E4 > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000E5 > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000E6 > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000E7 > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000E8 > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000E9 > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000EA > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000EB > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000EC > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000ED > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000EE > > 2002-10-08 20:37:13 DEBUG: recycled transaction log file > > 0000000A000000EF > > 2002-10-08 20:37:13 DEBUG: reaping dead processes > > 2002-10-08 20:37:13 DEBUG: child process (pid 15270) exited with exit > > code 0 > > > > ... repeat ad nauseum. The problem is, each "recycle transaction > > log ... reaping dead child process" cycle takes about 4-7 minutes > > ... meaning that the procedure can take up to 1/2 hour to finish, > > and sometimes not finish at all. > > > > Obviously, the system is telling me that it is running out of > > resources somehow. But I'm at my wit's end to figure out what > > resources, exactly. Suggestions? > > You're running out of WAL log space, iirc. Increase the number of WAL > logs available and you should be okay. If you're experiencing this > halfway through, I'd increase the size by 50%, say maybe 60-70% for > good measure. -sc Oh, yes, you are right. My hardware tuning guide mentions it. Strange it is called the transaction log file: http://www.ca.postgresql.org/docs/momjian/hw_performance/ Unless you are seeing this more freqently than every minute, it should be fine. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Oct 9 00:03:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0891C476224 for ; Wed, 9 Oct 2002 00:03:14 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 69F024761F8 for ; Wed, 9 Oct 2002 00:03:13 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1776515; Tue, 08 Oct 2002 21:01:58 -0700 From: "Josh Berkus" Subject: Re: What does this tell me? To: Bruce Momjian , Sean Chittenden Cc: Josh Berkus , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 08 Oct 2002 21:01:58 -0700 Message-ID: In-Reply-To: <200210090355.g993tAU02565@candle.pha.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/73 X-Sequence-Number: 90 Bruce, Sean, > Oh, yes, you are right. My hardware tuning guide mentions it. > Strange > it is called the transaction log file: > > http://www.ca.postgresql.org/docs/momjian/hw_performance/ > > Unless you are seeing this more freqently than every minute, it > should > be fine. Actually, it's apparently a real problem, because the function never completes. Each cycle of "recycling transaction logs" takes longer and longer, and eventually locks up completely. What the function is doing is a succession of data cleanup procedures, updating the same table about 50 times. I will be very thankful for the day when I can commit within a procedure. Unfortunately, I am already at the maximum number of WAL files (64). What do I do now? -Josh Berkus From pgsql-performance-owner@postgresql.org Wed Oct 9 00:07:33 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1705D475FC5 for ; Wed, 9 Oct 2002 00:07:32 -0400 (EDT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 07AD9475AD7 for ; Wed, 9 Oct 2002 00:07:30 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g9947O904553; Wed, 9 Oct 2002 00:07:24 -0400 (EDT) From: Bruce Momjian Message-Id: <200210090407.g9947O904553@candle.pha.pa.us> Subject: Re: What does this tell me? In-Reply-To: To: Josh Berkus Date: Wed, 9 Oct 2002 00:07:24 -0400 (EDT) Cc: Sean Chittenden , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/74 X-Sequence-Number: 91 Josh Berkus wrote: > Bruce, Sean, > > > Oh, yes, you are right. My hardware tuning guide mentions it. > > Strange > > it is called the transaction log file: > > > > http://www.ca.postgresql.org/docs/momjian/hw_performance/ > > > > Unless you are seeing this more freqently than every minute, it > > should > > be fine. > > Actually, it's apparently a real problem, because the function never > completes. Each cycle of "recycling transaction logs" takes longer > and longer, and eventually locks up completely. > > What the function is doing is a succession of data cleanup procedures, > updating the same table about 50 times. I will be very thankful for > the day when I can commit within a procedure. > > Unfortunately, I am already at the maximum number of WAL files (64). > What do I do now? Wow, that is interesting. I thought one big transaction wouldn't lock up the WAL records. I figured there would be a CHECKPOINT, and then the WAL records could be recycled, even though the transaction is still open. Where do you see 64 as the maximum number of WAL segments. What is your checkpoint_segments value? The actual number of files shouldn't be much more than twice that value. What PostgreSQL version are you using? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Oct 9 00:17:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5ACD1475D12 for ; Wed, 9 Oct 2002 00:17:47 -0400 (EDT) Received: from mailhost.nxad.com (lan.ext.nxad.com [66.250.180.254]) by postgresql.org (Postfix) with ESMTP id D9C50474E5C for ; Wed, 9 Oct 2002 00:17:46 -0400 (EDT) Received: from perrin.int.nxad.com (perrin.int.nxad.com [192.168.1.251]) by mailhost.nxad.com (Postfix) with ESMTP id 4BC6B212EF3; Tue, 8 Oct 2002 21:17:52 -0700 (PDT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id C125F20F01; Tue, 8 Oct 2002 21:17:50 -0700 (PDT) Date: Tue, 8 Oct 2002 21:17:50 -0700 From: Sean Chittenden To: Josh Berkus Cc: Bruce Momjian , pgsql-performance@postgresql.org Subject: Re: What does this tell me? Message-ID: <20021009041750.GB56492@perrin.int.nxad.com> References: <200210090355.g993tAU02565@candle.pha.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 6CEB 1B06 BFD3 70F6 95BE 7E4D 8E85 2E0A 5F5B 3ECB X-Web-Homepage: http://sean.chittenden.org/ X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/75 X-Sequence-Number: 92 > > Oh, yes, you are right. My hardware tuning guide mentions it. > > Strange it is called the transaction log file: > > > > http://www.ca.postgresql.org/docs/momjian/hw_performance/ > > > > Unless you are seeing this more freqently than every minute, it > > should > > be fine. > > Actually, it's apparently a real problem, because the function never > completes. Each cycle of "recycling transaction logs" takes longer > and longer, and eventually locks up completely. > > What the function is doing is a succession of data cleanup > procedures, updating the same table about 50 times. I will be very > thankful for the day when I can commit within a procedure. > > Unfortunately, I am already at the maximum number of WAL files (64). > What do I do now? Isn't it possible to increase the size of your wal logs? I seem to remember a tunable existing, but I can't find it in the default config. Someone else know how off the top of their head? -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Wed Oct 9 00:35:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D0535475F2C for ; Wed, 9 Oct 2002 00:35:06 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 415F1475EA4 for ; Wed, 9 Oct 2002 00:35:06 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1776567; Tue, 08 Oct 2002 21:33:52 -0700 From: "Josh Berkus" Subject: Re: What does this tell me? To: Bruce Momjian , Josh Berkus Cc: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 08 Oct 2002 21:33:52 -0700 Message-ID: In-Reply-To: <200210090425.g994PrA06235@candle.pha.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/76 X-Sequence-Number: 93 Bruce, > > First, an interesting wierdness from the VACUUM FULL ANALYZE: > > Analyzing elbs_clidesc > > 2002-10-08 21:08:08 DEBUG: SIInsertDataEntry: table is 70% full, > > signaling postmaster > > > > Huh? > > Well, you are dealing with elbs. That is the problem. ;-) As you probably guessed, the purpose of these procedures is to take a large amount (about 60mb) of not-normalized data from ELBS and normalize it for our web-based case management system. What's really frustrating about it is that we're only going to be doing this for 2-3 months before we jettison ELBS for reasons that should be obvious to you. But for those 2-3 months, the data transfer needs to work well, and right now it doesn't even finish. > You shoulnd't need that and it shouldn't lock up when it gets to 64. > It > should checkpoint and move on. The only problem with it being lower > is > that it will checkpoint more often. Well, I'll try 128 and see if that helps any. > > > Rest of postgresql.conf params after my signature. All > suggestions > > are welcome. This server has been acting "sick" since I started > with > > it, under-performing my workstation and MS SQL Server. Either I've > set > > something wrong, or there's a hardware problem I need to track > down. > > > > BTW, is there any problem for postgres in turning the fill access > time > > recorder in the host filesystem off? This is often good for a > minor > > performance gain. > > No problem. > > You might want to try pgbench and see if that works. Yeah. I was planning on that -- as well as the postgresql.conf tuner -- as soon as I can get through one data transfer so that I have a little working time. -Josh Berkus From pgsql-performance-owner@postgresql.org Wed Oct 9 00:38:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1AAFD475FBA for ; Wed, 9 Oct 2002 00:38:14 -0400 (EDT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 6185D475EA4 for ; Wed, 9 Oct 2002 00:38:12 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g994cAU07439; Wed, 9 Oct 2002 00:38:10 -0400 (EDT) From: Bruce Momjian Message-Id: <200210090438.g994cAU07439@candle.pha.pa.us> Subject: Re: What does this tell me? In-Reply-To: To: Josh Berkus Date: Wed, 9 Oct 2002 00:38:10 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/77 X-Sequence-Number: 94 Josh Berkus wrote: > > > Rest of postgresql.conf params after my signature. All > > suggestions > > > are welcome. This server has been acting "sick" since I started > > with > > > it, under-performing my workstation and MS SQL Server. Either I've > > set > > > something wrong, or there's a hardware problem I need to track > > down. > > > > > > BTW, is there any problem for postgres in turning the fill access > > time > > > recorder in the host filesystem off? This is often good for a > > minor > > > performance gain. > > > > No problem. > > > > You might want to try pgbench and see if that works. > > Yeah. I was planning on that -- as well as the postgresql.conf tuner > -- as soon as I can get through one data transfer so that I have a > little working time. I was suggesting pgbench because the system should never lock up on you. Maybe something is very wrong. What happens if you issue the CHECKPOINT command? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Oct 9 00:56:43 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B7373476579 for ; Wed, 9 Oct 2002 00:56:42 -0400 (EDT) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 291D8476576 for ; Wed, 9 Oct 2002 00:56:42 -0400 (EDT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1350871; Tue, 08 Oct 2002 21:29:49 -0700 Message-ID: <3DA3B6B9.4010207@joeconway.com> Date: Tue, 08 Oct 2002 21:55:21 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: Bruce Momjian , Sean Chittenden , pgsql-performance@postgresql.org Subject: Re: What does this tell me? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/78 X-Sequence-Number: 95 Josh Berkus wrote: > What the function is doing is a succession of data cleanup procedures, > updating the same table about 50 times. I will be very thankful for > the day when I can commit within a procedure. If that's the case, can you split the work up into multiple functions, and execute them all from a shell script? Or perhaps even offload some of the data massaging to perl or something? (It would be easier to recommend alternate approaches with more details.) Joe From pgsql-performance-owner@postgresql.org Wed Oct 9 01:22:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 09F9E47651C for ; Wed, 9 Oct 2002 01:22:35 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 6A65D4764C8 for ; Wed, 9 Oct 2002 01:22:34 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g995MQhR017559; Wed, 9 Oct 2002 01:22:26 -0400 (EDT) To: "Josh Berkus" Cc: Bruce Momjian , Sean Chittenden , pgsql-performance@postgresql.org Subject: Re: What does this tell me? In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Tue, 08 Oct 2002 21:01:58 -0700" Date: Wed, 09 Oct 2002 01:22:26 -0400 Message-ID: <17558.1034140946@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/79 X-Sequence-Number: 96 "Josh Berkus" writes: > Actually, it's apparently a real problem, because the function never > completes. Each cycle of "recycling transaction logs" takes longer > and longer, and eventually locks up completely. > What the function is doing is a succession of data cleanup procedures, > updating the same table about 50 times. I will be very thankful for > the day when I can commit within a procedure. I think you are barking up the wrong tree. The messages you show are perfectly normal operation, and prove nothing much except that you pumped a lot of database updates through the system. I think there's something wrong with your data transformation application logic; or perhaps you are pumping so many updates through your tables that you need some intermediate VACUUMs to get rid of dead tuples. But messing with the WAL log parameters isn't going to do a darn thing for you ... IMHO anyway. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Oct 9 01:23:57 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A55FE475E60 for ; Wed, 9 Oct 2002 01:23:56 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 193A2475D12 for ; Wed, 9 Oct 2002 01:23:56 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1776618; Tue, 08 Oct 2002 22:22:37 -0700 From: "Josh Berkus" Subject: Re: What does this tell me? To: Joe Conway , Josh Berkus Cc: Bruce Momjian , Sean Chittenden , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 08 Oct 2002 22:22:37 -0700 Message-ID: In-Reply-To: <3DA3B6B9.4010207@joeconway.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/80 X-Sequence-Number: 97 Joe, > If that's the case, can you split the work up into multiple > functions, and execute them all from a shell script? Or perhaps even > offload some of the data massaging to perl or something? (It would be > easier to recommend alternate approaches with more details.) I've already split it up into 11 functions, which are being managed through Perl with ANALYZE statements between. Breaking it down further would be really unmanageable. Not to be mean or anything (after all, I just joined pgsql-advocacy), I'm getting *much* worse performance on large data transformations from PostgreSQL 7.2.1, than I get from SQL Server 7.0 on inferior hardware (at least, except where SQL Server 7.0 crashes). I really am determined to prove that it's because I've misconfigured it, and I thank all of you for your help in doing so. PGBench Results: transaction type: TPC-B (sort of) scaling factor: 10 number of clients: 100 number of transactions per client: 10 number of transactions actually processed: 1000/1000 tps = 93.206356(including connections establishing) tps = 103.237007(excluding connections establishing) Of course, I don't have much to compare these to, so I don't know if that's good or bad. -Josh Berkus From pgsql-general-owner@postgresql.org Wed Oct 9 03:57:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D6D95476461 for ; Wed, 9 Oct 2002 03:57:31 -0400 (EDT) Received: from email03.aon.at (WARSL402PIP6.highway.telekom.at [195.3.96.93]) by postgresql.org (Postfix) with SMTP id 10906475D12 for ; Wed, 9 Oct 2002 03:57:28 -0400 (EDT) Received: (qmail 132272 invoked from network); 9 Oct 2002 07:57:27 -0000 Received: from m156p023.dipool.highway.telekom.at (HELO cantor) ([62.46.9.119]) (envelope-sender ) by qmail3rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 9 Oct 2002 07:57:27 -0000 From: Manfred Koizar To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: Large databases, performance Date: Wed, 09 Oct 2002 10:00:03 +0200 Message-ID: References: <3D9C3E05.7070906@clearmetrix.com> <3DA1A331.21316.F7E742B@localhost> In-Reply-To: <3DA1A331.21316.F7E742B@localhost> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="--=_3go7qusj2mfc5mqkb950rta73h7v8jn4qv.MFSBCHJLHS" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/487 X-Sequence-Number: 31485 ----=_3go7qusj2mfc5mqkb950rta73h7v8jn4qv.MFSBCHJLHS Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Mon, 07 Oct 2002 15:07:29 +0530, "Shridhar Daithankar" wrote: >Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. Shridhar, here is an implementation of a set of user types: char3, char4, char10. Put the attached files into a new directory contrib/fixchar, make, make install, and run fixchar.sql through psql. Then create your table as CREATE TABLE tbl ( type int, esn char10, min char10, datetime timestamp, opc0 char3, ... rest char4, field0 int, field1 char4, ... ) This should save 76 bytes per heap tuple and 12 bytes per index tuple, giving a database size of ~ 76 GB. I'd be very interested how this affects performance. Code has been tested for v7.2, it crashes on v7.3 beta 1. If this is a problem, let me know. Servus Manfred ----=_3go7qusj2mfc5mqkb950rta73h7v8jn4qv.MFSBCHJLHS Content-Type: text/plain; charset=us-ascii; name=fixcharNN.sql.in Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=fixcharNN.sql.in -- User type charNN: space saving replacement for char(NN) CREATE FUNCTION charNN_in(opaque) RETURNS charNN AS '$libdir/fixchar' LANGUAGE 'c'; CREATE FUNCTION charNN_out(opaque) RETURNS opaque AS '$libdir/fixchar' LANGUAGE 'c'; CREATE TYPE charNN ( INPUT = charNN_in, OUTPUT = charNN_out, INTERNALLENGTH = NN, ALIGNMENT = char ); -- Operators CREATE FUNCTION charNN_lt(charNN, charNN) RETURNS boolean AS '$libdir/fixchar' LANGUAGE 'c'; CREATE FUNCTION charNN_le(charNN, charNN) RETURNS boolean AS '$libdir/fixchar' LANGUAGE 'c'; CREATE FUNCTION charNN_eq(charNN, charNN) RETURNS boolean AS '$libdir/fixchar' LANGUAGE 'c'; CREATE FUNCTION charNN_ge(charNN, charNN) RETURNS boolean AS '$libdir/fixchar' LANGUAGE 'c'; CREATE FUNCTION charNN_gt(charNN, charNN) RETURNS boolean AS '$libdir/fixchar' LANGUAGE 'c'; CREATE FUNCTION charNN_ne(charNN, charNN) RETURNS boolean AS '$libdir/fixchar' LANGUAGE 'c'; CREATE OPERATOR < ( LEFTARG = charNN, RIGHTARG = charNN, PROCEDURE = charNN_lt, COMMUTATOR = >, NEGATOR = >=, RESTRICT = scalarltsel, JOIN = scalarltjoinsel ); CREATE OPERATOR <= ( LEFTARG = charNN, RIGHTARG = charNN, PROCEDURE = charNN_le, COMMUTATOR = >=, NEGATOR = >, RESTRICT = scalarltsel, JOIN = scalarltjoinsel ); CREATE OPERATOR = ( LEFTARG = charNN, RIGHTARG = charNN, PROCEDURE = charNN_eq, COMMUTATOR = =, NEGATOR = !=, RESTRICT = eqsel, JOIN = eqjoinsel ); CREATE OPERATOR >= ( LEFTARG = charNN, RIGHTARG = charNN, PROCEDURE = charNN_ge, COMMUTATOR = <=, NEGATOR = <, RESTRICT = scalargtsel, JOIN = scalargtjoinsel ); CREATE OPERATOR > ( LEFTARG = charNN, RIGHTARG = charNN, PROCEDURE = charNN_gt, COMMUTATOR = <, NEGATOR = <=, RESTRICT = scalargtsel, JOIN = scalargtjoinsel ); CREATE OPERATOR != ( LEFTARG = charNN, RIGHTARG = charNN, PROCEDURE = charNN_ne, COMMUTATOR = !=, NEGATOR = =, RESTRICT = neqsel, JOIN = neqjoinsel ); -- btree opclass INSERT INTO pg_opclass (opcamid, opcname, opcintype, opcdefault, opckeytype) SELECT a.oid, 'charNN_ops', t.oid, true, 0 FROM pg_am a, pg_type t WHERE a.amname = 'btree' AND t.typname = 'charNN'; --btree strategies CREATE TEMP TABLE charNN_strat ( strat smallint, opr name ); INSERT INTO charNN_strat VALUES (1, '<'); INSERT INTO charNN_strat VALUES (2, '<='); INSERT INTO charNN_strat VALUES (3, '='); INSERT INTO charNN_strat VALUES (4, '>='); INSERT INTO charNN_strat VALUES (5, '>'); SELECT o.oid AS opoid, s.strat INTO TEMP TABLE charNN_ops_tmp FROM pg_operator o, pg_type t, charNN_strat s WHERE t.typname = 'charNN' AND o.oprleft = t.oid AND o.oprright = t.oid AND o.oprname = s.opr; INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr) SELECT oc.oid, c.strat, false, c.opoid FROM pg_opclass oc, charNN_ops_tmp c, pg_am a WHERE opcamid = a.oid AND opcname = 'charNN_ops' AND a.amname = 'btree'; -- support routine CREATE FUNCTION charNN_cmp(charNN, charNN) RETURNS integer AS '$libdir/fixchar' LANGUAGE 'c'; INSERT INTO pg_amproc (amopclaid, amprocnum, amproc) SELECT oc.oid, 1, p.oid FROM pg_opclass oc, pg_proc p, pg_am a WHERE a.amname = 'btree' AND oc.opcamid = a.oid AND oc.opcname = 'charNN_ops' AND p.proname = 'charNN_cmp'; ----=_3go7qusj2mfc5mqkb950rta73h7v8jn4qv.MFSBCHJLHS Content-Type: text/plain; charset=us-ascii; name=Makefile Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=Makefile # fixchar Makefile # # Experimental code! Use at your own risk! # 2002-10-08 mk subdir = contrib/fixchar top_builddir = ../.. include $(top_builddir)/src/Makefile.global MODULE_big = fixchar OBJS = char3.o char4.o char10.o DATA_built = fixchar.sql DOCS = README.fixchar char%.c: fixcharNN.c.in sed -e 's/NN/$*/g' $< >$@ fixchar.sql: char3.sql char4.sql char10.sql cat $^ >$@ char%.sql: fixcharNN.sql.in sed -e 's/NN/$*/g' $< >$@ include $(top_srcdir)/contrib/contrib-global.mk ----=_3go7qusj2mfc5mqkb950rta73h7v8jn4qv.MFSBCHJLHS Content-Type: text/plain; charset=us-ascii; name=fixcharNN.c.in Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=fixcharNN.c.in #include "postgres.h" char *charNN_in(char *cstr); char *charNN_out(char *sstr); bool charNN_lt(char *a, char *b); bool charNN_le(char *a, char *b); bool charNN_eq(char *a, char *b); bool charNN_ge(char *a, char *b); bool charNN_gt(char *a, char *b); bool charNN_ne(char *a, char *b); int4 charNN_cmp(char *a, char *b); char * charNN_in(char *cstr) { char *result; int len; int i; len = strlen(cstr); if (len > NN) len = NN; result = (char *) palloc(NN); for (i = 0; i < len; ++i) result[i] = cstr[i]; for (; i < NN; ++i) result[i] = ' '; return result; }/*charNN_in*/ char * charNN_out(char *sstr) { char *result; int i; if (sstr == NULL) return NULL; result = (char *) palloc(NN + 1); for (i = 0; i < NN; ++i) result[i] = sstr[i]; result[NN] = '\0'; return result; }/*charNN_out*/ bool charNN_lt(char *a, char *b) { return (strncmp(a, b, NN) < 0); }/*charNN_lt*/ bool charNN_le(char *a, char *b) { return (strncmp(a, b, NN) <= 0); }/*charNN_le*/ bool charNN_eq(char *a, char *b) { return (strncmp(a, b, NN) == 0); }/*charNN_eq*/ bool charNN_ge(char *a, char *b) { return (strncmp(a, b, NN) >= 0); }/*charNN_ge*/ bool charNN_gt(char *a, char *b) { return (strncmp(a, b, NN) > 0); }/*charNN_gt*/ bool charNN_ne(char *a, char *b) { return (strncmp(a, b, NN) != 0); }/*charNN_ne*/ int4 charNN_cmp(char *a, char *b) { return strncmp(a, b, NN); }/*charNN_cmp*/ ----=_3go7qusj2mfc5mqkb950rta73h7v8jn4qv.MFSBCHJLHS Content-Type: text/plain; charset=us-ascii; name=README.fixchar Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=README.fixchar fixchar ======= User data types char3, char4 and char10 as space saving replacements for char(3), char(4), and char(10) respectively. This is an experimental implementation for Shridhar's high volume performance tests. It is not expected to be usable in any real world application. Known problems are at least: . There are no casting functions . This does not work with multibyte character sets Use at your own risk! I N S T A L L ============= . Put these files into contrib/fixchar . cd to contrib/fixchar . make . make install . cd to the directory where PG is installed . bin/psql yourdb yourdb=# \i share/postgresql/contrib/fixchar.sql T E S T ======= CREATE TABLE short ( i INT, c3 char3, c4 char4, c10 char10, primary key (i, c3) ); CREATE TABLE long ( i INT, c3 char(3), c4 char(4), c10 char(10), primary key (i, c3) ); INSERT INTO short VALUES (1, 'aaa', 'aaaa', 'a'); INSERT INTO long VALUES (1, 'aaa', 'aaaa', 'a'); INSERT INTO short SELECT i+1, c3, c4, c10 FROM short; INSERT INTO long SELECT i+1, c3, c4, c10 FROM long; INSERT INTO short SELECT i+2, c3, c4, c10 FROM short; INSERT INTO long SELECT i+2, c3, c4, c10 FROM long; INSERT INTO short SELECT i+4, c3, c4, c10 FROM short; INSERT INTO long SELECT i+4, c3, c4, c10 FROM long; INSERT INTO short SELECT i+8, c3, c4, c10 FROM short; INSERT INTO long SELECT i+8, c3, c4, c10 FROM long; INSERT INTO short SELECT i+16, c3, c4, c10 FROM short; INSERT INTO long SELECT i+16, c3, c4, c10 FROM long; INSERT INTO short SELECT i+32, c3, c4, c10 FROM short; INSERT INTO long SELECT i+32, c3, c4, c10 FROM long; INSERT INTO short SELECT i+64, c3, c4, c10 FROM short; INSERT INTO long SELECT i+64, c3, c4, c10 FROM long; INSERT INTO short SELECT i+128, c3, c4, c10 FROM short; INSERT INTO long SELECT i+128, c3, c4, c10 FROM long; INSERT INTO short SELECT i+256, c3, c4, c10 FROM short; INSERT INTO long SELECT i+256, c3, c4, c10 FROM long; INSERT INTO short SELECT i+512, c3, c4, c10 FROM short; INSERT INTO long SELECT i+512, c3, c4, c10 FROM long; INSERT INTO short SELECT i+1024, c3, c4, c10 FROM short; INSERT INTO long SELECT i+1024, c3, c4, c10 FROM long; INSERT INTO short SELECT i+2048, c3, c4, c10 FROM short; INSERT INTO long SELECT i+2048, c3, c4, c10 FROM long; INSERT INTO short SELECT i+4096, c3, c4, c10 FROM short; INSERT INTO long SELECT i+4096, c3, c4, c10 FROM long; VACUUM VERBOSE ANALYZE short; VACUUM VERBOSE ANALYZE long; SELECT relname,reltuples,relpages FROM pg_class WHERE relname NOT LIKE 'pg%'; relname | reltuples | relpages ------------+-----------+---------- short_pkey | 8192 | 33 short | 8192 | 57 long_pkey | 8192 | 39 long | 8192 | 69 (4 rows) (2002-10-08 mk) ----=_3go7qusj2mfc5mqkb950rta73h7v8jn4qv.MFSBCHJLHS-- From pgsql-general-owner@postgresql.org Wed Oct 9 04:06:49 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 47B4F475F09 for ; Wed, 9 Oct 2002 04:06:47 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 92045475B84 for ; Wed, 9 Oct 2002 04:06:45 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g9988KV04620 for ; Wed, 9 Oct 2002 13:38:20 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g9988Jv04605; Wed, 9 Oct 2002 13:38:20 +0530 From: "Shridhar Daithankar" To: Manfred Koizar , pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Date: Wed, 09 Oct 2002 13:37:13 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA43109.23106.1978CDFD@localhost> In-reply-to: References: <3DA1A331.21316.F7E742B@localhost> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/488 X-Sequence-Number: 31486 On 9 Oct 2002 at 10:00, Manfred Koizar wrote: > On Mon, 07 Oct 2002 15:07:29 +0530, "Shridhar Daithankar" > wrote: > >Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. > > Shridhar, > > here is an implementation of a set of user types: char3, char4, > char10. Put the attached files into a new directory contrib/fixchar, > make, make install, and run fixchar.sql through psql. Then create > your table as > CREATE TABLE tbl ( > type int, > esn char10, > min char10, > datetime timestamp, > opc0 char3, > ... > rest char4, > field0 int, > field1 char4, > ... > ) > > This should save 76 bytes per heap tuple and 12 bytes per index tuple, > giving a database size of ~ 76 GB. I'd be very interested how this > affects performance. > > Code has been tested for v7.2, it crashes on v7.3 beta 1. If this is > a problem, let me know. Thank you very much for this. I would certainly give it a try. Please be patient as next test is scheuled on monday. Bye Shridhar -- love, n.: When it's growing, you don't mind watering it with a few tears. From pgsql-general-owner@postgresql.org Wed Oct 9 04:25:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E3F4F475EA4 for ; Wed, 9 Oct 2002 04:24:59 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 01978475E60 for ; Wed, 9 Oct 2002 04:24:58 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g998QYO06583 for ; Wed, 9 Oct 2002 13:56:34 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g998QYv06568; Wed, 9 Oct 2002 13:56:34 +0530 From: "Shridhar Daithankar" To: Manfred Koizar , pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Date: Wed, 09 Oct 2002 13:55:28 +0530 MIME-Version: 1.0 Subject: Re: Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA43550.21288.1989824B@localhost> In-reply-to: References: <3DA1A331.21316.F7E742B@localhost> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/489 X-Sequence-Number: 31487 On 9 Oct 2002 at 10:00, Manfred Koizar wrote: > On Mon, 07 Oct 2002 15:07:29 +0530, "Shridhar Daithankar" > wrote: > >Only worry is database size. Postgresql is 111GB v/s 87 GB for mysql. > > Shridhar, > > here is an implementation of a set of user types: char3, char4, > char10. Put the attached files into a new directory contrib/fixchar, > make, make install, and run fixchar.sql through psql. Then create > your table as I had a quick look in things. I think it's a great learning material for pg internals..;-) I have a suggestion. In README, it should be worth mentioning that, new types can be added just by changin Makefile. e.g. Changing line OBJS = char3.o char4.o char10.o to OBJS = char3.o char4.o char5.o char10.o would add the datatype char5 as well. Obviously this is for those who might not take efforts to read the source. ( Personally I wouldn't have, had it been part of entire postgres source dump. Just would have done ./configure;make;make install) Thanks for the solution. It wouldn't have occurred to me in ages to create a type for this. I guess that's partly because never used postgresql beyond select/insert/update/delete. Anyway should have been awake.. Thanks once again Bye Shridhar -- But it's real. And if it's real it can be affected ... we may not be ableto break it, but, I'll bet you credits to Navy Beans we can put a dent in it. -- deSalle, "Catspaw", stardate 3018.2 From pgsql-general-owner@postgresql.org Wed Oct 9 09:33:14 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 404464760DF; Wed, 9 Oct 2002 09:33:04 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 42696476082; Wed, 9 Oct 2002 09:32:59 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g99DWphR019698; Wed, 9 Oct 2002 09:32:51 -0400 (EDT) To: Manfred Koizar Cc: shridhar_daithankar@persistent.co.in, pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: [pgsql-performance] Large databases, performance In-reply-to: References: <3D9C3E05.7070906@clearmetrix.com> <3DA1A331.21316.F7E742B@localhost> Comments: In-reply-to Manfred Koizar message dated "Wed, 09 Oct 2002 10:00:03 +0200" Date: Wed, 09 Oct 2002 09:32:50 -0400 Message-ID: <19697.1034170370@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/494 X-Sequence-Number: 31492 Manfred Koizar writes: > here is an implementation of a set of user types: char3, char4, > char10. Coupla quick comments on these: > CREATE FUNCTION charNN_lt(charNN, charNN) > RETURNS boolean > AS '$libdir/fixchar' > LANGUAGE 'c'; > bool > charNN_lt(char *a, char *b) > { > return (strncmp(a, b, NN) < 0); > }/*charNN_lt*/ These functions are dangerous as written, because they will crash on null inputs. I'd suggest marking them strict in the function declarations. Some attention to volatility declarations (isCachable or isImmutable) would be a good idea too. Also, it'd be faster and more portable to write the functions with version-1 calling conventions. Using the Makefile to auto-create the differently sized versions is a slick trick... regards, tom lane From pgsql-general-owner@postgresql.org Wed Oct 9 09:41:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 62F9F476786 for ; Wed, 9 Oct 2002 09:41:44 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 17A524765E8 for ; Wed, 9 Oct 2002 09:40:43 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g99Deep09786 for ; Wed, 9 Oct 2002 19:10:40 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g99Dedv09776; Wed, 9 Oct 2002 19:10:39 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Date: Wed, 09 Oct 2002 19:11:09 +0530 MIME-Version: 1.0 Subject: Re: [pgsql-performance] Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA47F4D.12909.1AAA876E@localhost> References: In-reply-to: <19697.1034170370@sss.pgh.pa.us> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/496 X-Sequence-Number: 31494 On 9 Oct 2002 at 9:32, Tom Lane wrote: > Manfred Koizar writes: > > here is an implementation of a set of user types: char3, char4, > > char10. > > Coupla quick comments on these: > > > CREATE FUNCTION charNN_lt(charNN, charNN) > > RETURNS boolean > > AS '$libdir/fixchar' > > LANGUAGE 'c'; > > > bool > > charNN_lt(char *a, char *b) > > { > > return (strncmp(a, b, NN) < 0); > > }/*charNN_lt*/ > > These functions are dangerous as written, because they will crash on > null inputs. I'd suggest marking them strict in the function > declarations. Some attention to volatility declarations (isCachable > or isImmutable) would be a good idea too. Let me add something. Using char* is bad idea. I had faced a situation recently on HP-UX 11 that with a libc patch, isspace collapsed for char>127. Fix was to use unsigned char. There are other places also where the input character is used as index to an array internally and can cause weird behaviour for values >127 I will apply both the correction here. Will post the final stuff soon. Bye Shridhar -- Hacker's Quicky #313: Sour Cream -n- Onion Potato Chips Microwave Egg Roll Chocolate Milk From pgsql-performance-owner@postgresql.org Wed Oct 9 10:01:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 71B0C475DA3 for ; Wed, 9 Oct 2002 10:01:54 -0400 (EDT) Received: from briar.mmrd.com (unknown [208.255.226.182]) by postgresql.org (Postfix) with ESMTP id 79A62475D12 for ; Wed, 9 Oct 2002 10:01:53 -0400 (EDT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by briar.mmrd.com (8.11.2/8.11.2) with ESMTP id g99ExWF16134; Wed, 9 Oct 2002 10:59:32 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id g99E1qx07802; Wed, 9 Oct 2002 10:01:54 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id TK2FX4X1; Wed, 9 Oct 2002 10:01:51 -0400 Subject: Re: What does this tell me? From: Robert Treat To: Josh Berkus Cc: Joe Conway , Bruce Momjian , Sean Chittenden , pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 09 Oct 2002 09:57:18 -0400 Message-Id: <1034171838.11703.11.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/86 X-Sequence-Number: 103 On Wed, 2002-10-09 at 01:22, Josh Berkus wrote: > Joe, > > > If that's the case, can you split the work up into multiple > > functions, and execute them all from a shell script? Or perhaps even > > offload some of the data massaging to perl or something? (It would be > > easier to recommend alternate approaches with more details.) > > I've already split it up into 11 functions, which are being managed > through Perl with ANALYZE statements between. Breaking it down > further would be really unmanageable. > If I read Tom's suggestion correctly, you should probably change these to vacuum analyze instead of analyze. > Not to be mean or anything (after all, I just joined pgsql-advocacy), > I'm getting *much* worse performance on large data transformations from > PostgreSQL 7.2.1, than I get from SQL Server 7.0 on inferior hardware > (at least, except where SQL Server 7.0 crashes). what?? that's blasphamy!! revoke this mans advocacy membership right now!! ;-) I really am determined > to prove that it's because I've misconfigured it, and I thank all of > you for your help in doing so. > FWIW I just ran into a similar situation where I was doing 6 simultaneous pg_restores of our production database on my local workstation. Apparently this pumps a lot of data through the wal logs. I did kick up the number of wal files, but I also ended up kicking up the number of wal_buffers as well and that seemed to help. Robert Treat From pgsql-general-owner@postgresql.org Wed Oct 9 12:57:16 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 71E7F47688D; Wed, 9 Oct 2002 12:57:14 -0400 (EDT) Received: from aquilandia.com (unknown [195.55.211.234]) by postgresql.org (Postfix) with ESMTP id AD2FF4765B3; Wed, 9 Oct 2002 12:57:09 -0400 (EDT) Received: from leo [213.97.49.3] by aquilandia.com (SMTPD32-6.06) id A27C3A3C005E; Wed, 09 Oct 2002 19:08:12 +0200 From: "Jose Antonio Leo" To: , Subject: problem with the Index Date: Wed, 9 Oct 2002 18:56:41 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: <19697.1034170370@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/513 X-Sequence-Number: 31511 I have a problem with the index of 1 table. I hava a table created : CREATE TABLE "acucliart" ( "cod_pto" numeric(8,0) NOT NULL, "cod_cli" varchar(9) NOT NULL, "mes" numeric(2,0) NOT NULL, "ano" numeric(4,0) NOT NULL, "int_art" numeric(5,0) NOT NULL, "cantidad" numeric(12,2), "ven_siv_to" numeric(14,2), "ven_civ_to" numeric(14,2), "tic_siv_to" numeric(14,2), "tic_civ_to" numeric(14,2), "visitas" numeric(2,0), "ult_vis" date, "ven_cos" numeric(12,2), "ven_ofe" numeric(12,2), "cos_ofe" numeric(12,2), CONSTRAINT "acucliart_pkey" PRIMARY KEY ("cod_cli") ); if i do this select: explain select * from acucliart where cod_cli=10000; postgres use the index NOTICE: QUERY PLAN: Index Scan using cod_cli_ukey on acucliart (cost=0.00..4.82 rows=1 width=478) and this select explain select * from acucliart where cod_cli>10000; Postgres don't use the index: NOTICE: QUERY PLAN: Seq Scan on acucliart (cost=0.00..22.50 rows=333 width=478) why? tk From pgsql-general-owner@postgresql.org Wed Oct 9 13:31:14 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 37203476520; Wed, 9 Oct 2002 13:31:13 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 8259C476527; Wed, 9 Oct 2002 13:31:12 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 68A09D60C; Wed, 9 Oct 2002 10:31:12 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 5C3FB5C03; Wed, 9 Oct 2002 10:31:12 -0700 (PDT) Date: Wed, 9 Oct 2002 10:31:12 -0700 (PDT) From: Stephan Szabo To: Jose Antonio Leo Cc: , Subject: Re: [SQL] problem with the Index In-Reply-To: Message-ID: <20021009102800.U4728-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/515 X-Sequence-Number: 31513 On Wed, 9 Oct 2002, Jose Antonio Leo wrote: > I have a problem with the index of 1 table. > > I hava a table created : > CREATE TABLE "acucliart" ( > "cod_pto" numeric(8,0) NOT NULL, > "cod_cli" varchar(9) NOT NULL, > "mes" numeric(2,0) NOT NULL, > "ano" numeric(4,0) NOT NULL, > "int_art" numeric(5,0) NOT NULL, > "cantidad" numeric(12,2), > "ven_siv_to" numeric(14,2), > "ven_civ_to" numeric(14,2), > "tic_siv_to" numeric(14,2), > "tic_civ_to" numeric(14,2), > "visitas" numeric(2,0), > "ult_vis" date, > "ven_cos" numeric(12,2), > "ven_ofe" numeric(12,2), > "cos_ofe" numeric(12,2), > CONSTRAINT "acucliart_pkey" > PRIMARY KEY ("cod_cli") > ); > > if i do this select: > explain select * from acucliart where cod_cli=10000; > postgres use the index > NOTICE: QUERY PLAN: > Index Scan using cod_cli_ukey on acucliart (cost=0.00..4.82 rows=1 > width=478) > > and this select > explain select * from acucliart where cod_cli>10000; > Postgres don't use the index: > NOTICE: QUERY PLAN: > Seq Scan on acucliart (cost=0.00..22.50 rows=333 width=478) > > why? Well, how many rows are in the table? In the first case it estimates 1 row will be returned, in the second 333. Index scans are not always faster than sequential scans as the percentage of the table to scan becomes larger. If you haven't analyzed recently, you probably should do so and if you want to compare, set enable_seqscan=off and try an explain there and see what it gives you. Also, why are you comparing a varchar(9) column with an integer? From pgsql-general-owner@postgresql.org Wed Oct 9 14:06:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AD3344760F9 for ; Wed, 9 Oct 2002 14:06:26 -0400 (EDT) Received: from email03.aon.at (WARSL402PIP6.highway.telekom.at [195.3.96.93]) by postgresql.org (Postfix) with SMTP id CCE39476018 for ; Wed, 9 Oct 2002 14:06:25 -0400 (EDT) Received: (qmail 60658 invoked from network); 9 Oct 2002 18:06:25 -0000 Received: from m155p004.dipool.highway.telekom.at (HELO cantor) ([62.46.9.68]) (envelope-sender ) by qmail3rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 9 Oct 2002 18:06:25 -0000 From: Manfred Koizar To: Tom Lane Cc: shridhar_daithankar@persistent.co.in, pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: [pgsql-performance] Large databases, performance Date: Wed, 09 Oct 2002 20:09:03 +0200 Message-ID: References: <3D9C3E05.7070906@clearmetrix.com> <3DA1A331.21316.F7E742B@localhost> <19697.1034170370@sss.pgh.pa.us> In-Reply-To: <19697.1034170370@sss.pgh.pa.us> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/518 X-Sequence-Number: 31516 On Wed, 09 Oct 2002 09:32:50 -0400, Tom Lane wrote: >Coupla quick comments on these: My first attempt on user types; thanks for the tips. >These functions are dangerous as written, because they will crash on >null inputs. I'd suggest marking them strict in the function >declarations. I was not aware of this, just wondered why bpchar routines didn't crash :-) Fixed. >Some attention to volatility declarations (isCachable >or isImmutable) would be a good idea too. >Also, it'd be faster and more portable to write the functions with >version-1 calling conventions. Done, too. In the meantime I've found out why it crashed with 7.3: INSERT INTO pg_opclass is now obsolete, have to use CREATE OPERATOR CLASS ... Servus Manfred From pgsql-performance-owner@postgresql.org Wed Oct 9 15:32:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D73964762B6 for ; Wed, 9 Oct 2002 15:32:25 -0400 (EDT) Received: from www.fastmail.fm (fastmail.fm [209.61.183.86]) by postgresql.org (Postfix) with ESMTP id 10E9C47625A for ; Wed, 9 Oct 2002 15:32:25 -0400 (EDT) Received: from www.fastmail.fm (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 3CBCF6DC63 for ; Wed, 9 Oct 2002 14:32:20 -0500 (CDT) Received: from server3.fastmail.fm (server3.internal [10.202.2.134]) by www.fastmail.fm (Postfix) with ESMTP id 297366DC2D for ; Wed, 9 Oct 2002 14:32:20 -0500 (CDT) Received: by server3.fastmail.fm (Postfix, from userid 99) id C09572FD0D; Wed, 9 Oct 2002 14:32:19 -0500 (CDT) Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="ISO-8859-1" MIME-Version: 1.0 X-Mailer: MIME::Lite 1.2 (F2.6; T1.001; A1.48; B2.12; Q2.03) Date: Wed, 9 Oct 2002 19:32:19 UT From: "Rich Scott" To: pgsql-performance@postgresql.org X-Epoch: 1034191940 X-Sasl-enc: acgzKuQLJe351nh8uGzN/A Message-Id: <20021009193219.C09572FD0D@server3.fastmail.fm> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/88 X-Sequence-Number: 105 subscribe pgsql-performance From pgsql-performance-owner@postgresql.org Thu Oct 10 09:27:59 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6C9864766C9 for ; Thu, 10 Oct 2002 09:27:56 -0400 (EDT) Received: from email04.aon.at (WARSL402PIP5.highway.telekom.at [195.3.96.79]) by postgresql.org (Postfix) with SMTP id 8786F47634E for ; Thu, 10 Oct 2002 09:27:48 -0400 (EDT) Received: (qmail 84484 invoked from network); 10 Oct 2002 13:27:50 -0000 Received: from m152p011.dipool.highway.telekom.at (HELO cantor) ([62.46.8.235]) (envelope-sender ) by qmail5rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 10 Oct 2002 13:27:50 -0000 From: Manfred Koizar To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org Subject: contrib/fixchar (Was: Large databases, performance) Date: Thu, 10 Oct 2002 15:30:31 +0200 Message-ID: References: <3D9C3E05.7070906@clearmetrix.com> <3DA1A331.21316.F7E742B@localhost> In-Reply-To: X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/89 X-Sequence-Number: 106 On Wed, 09 Oct 2002 10:00:03 +0200, I wrote: >here is an implementation of a set of user types: char3, char4, >char10. New version available. As I don't want to spam the list with various versions until I get it right eventually, you can get it from http://members.aon.at/pivot/pg/fixchar20021010.tgz if you are interested. What's new: . README updated (per Shridhar's suggestion) . doesn't crash on NULL (p. Tom) . version-1 calling conventions (p. Tom) . isCachable (p. Tom) . works for 7.2 (as delivered) and for 7.3 (make for73) Shridhar, you were concerned about signed/unsigned chars; looking at the code I can not see how this is a problem. So no change in this regard. Thanks for your comments. Have fun! Servus Manfred From pgsql-performance-owner@postgresql.org Thu Oct 10 09:48:43 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 43076476110 for ; Thu, 10 Oct 2002 09:48:41 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 33086475F6E for ; Thu, 10 Oct 2002 09:48:39 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g9ADmgJ24361 for ; Thu, 10 Oct 2002 19:18:42 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g9ADmfv24351; Thu, 10 Oct 2002 19:18:42 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org Date: Thu, 10 Oct 2002 19:19:11 +0530 MIME-Version: 1.0 Subject: Re: contrib/fixchar (Was: Large databases, performance) Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA5D2AF.24682.4EDF20B@localhost> In-reply-to: References: X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/90 X-Sequence-Number: 107 On 10 Oct 2002 at 15:30, Manfred Koizar wrote: > On Wed, 09 Oct 2002 10:00:03 +0200, I wrote: > >here is an implementation of a set of user types: char3, char4, > >char10. > > New version available. As I don't want to spam the list with various > versions until I get it right eventually, you can get it from > http://members.aon.at/pivot/pg/fixchar20021010.tgz if you are > interested. > > What's new: > > . README updated (per Shridhar's suggestion) > . doesn't crash on NULL (p. Tom) > . version-1 calling conventions (p. Tom) > . isCachable (p. Tom) > . works for 7.2 (as delivered) and for 7.3 (make for73) > > Shridhar, you were concerned about signed/unsigned chars; looking at > the code I can not see how this is a problem. So no change in this > regard. Well, this is not related to postgresql exactly but to summerise the problem, with libc patch PHCO_19090 or compatible upwards, on HP-UX11, isspace does not work correctly if input value is >127. Can cause lot of problem for an external app. It works fine with unsigned char Does not make a difference from postgrersql point of view but would break non- english locale if they want to use this fix under some situation. But I agree, unless somebody reports it, no point fixing it and we know the fix anyway.. Bye Shridhar -- Live long and prosper. -- Spock, "Amok Time", stardate 3372.7 From pgsql-performance-owner@postgresql.org Thu Oct 10 11:42:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9D22A476AB3 for ; Thu, 10 Oct 2002 11:42:11 -0400 (EDT) Received: from mailhub2.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by postgresql.org (Postfix) with ESMTP id D4254476AA9 for ; Thu, 10 Oct 2002 11:42:10 -0400 (EDT) Received: from [194.82.51.24] (helo=imail) by mailhub2.sghms.ac.uk with esmtp (Exim 4.05) id 17zfOH-0002jg-00 for pgsql-performance@postgresql.org; Thu, 10 Oct 2002 16:38:21 +0100 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.1 HotFix 0.7 (built May 7 2002)) with ESMTPA id <0H3R00F69VLCP1@imail.sghms.ac.uk> for pgsql-performance@postgresql.org; Thu, 10 Oct 2002 16:41:36 +0100 (BST) Date: Thu, 10 Oct 2002 16:41:43 +0100 From: Adam Witney To: pgsql-performance Message-id: MIME-version: 1.0 User-Agent: Microsoft-Entourage/10.1.0.2006 Subject: Info on explain output Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT X-Spam-Status: No, hits=-99.5 required=5.5 tests=TO_LOCALPART_EQ_REAL,USER_IN_WHITELIST version=2.31 X-Spam-Level: X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/91 X-Sequence-Number: 108 Hi, I am trying to optimise a complex query adding explicit joins and creating indices. I am going through the EXPLAIN output (~70 lines) but am fairly new at reading these. Are there any good rules of thumb of things one should be looking out for in EXPLAIN output? ie means that an index would be good here etc I have read through the docs for EXPLAIN, but I was wondering if there were any more detailed descriptions or docs on the subject. Thanks for any help adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From pgsql-performance-owner@postgresql.org Thu Oct 10 12:44:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1E007476112 for ; Thu, 10 Oct 2002 12:44:11 -0400 (EDT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 79A2F47600C for ; Thu, 10 Oct 2002 12:44:08 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g9AGi1F17476; Thu, 10 Oct 2002 12:44:01 -0400 (EDT) From: Bruce Momjian Message-Id: <200210101644.g9AGi1F17476@candle.pha.pa.us> Subject: Re: Info on explain output In-Reply-To: To: Adam Witney Date: Thu, 10 Oct 2002 12:44:01 -0400 (EDT) Cc: pgsql-performance X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/92 X-Sequence-Number: 109 Have you looked at the internals PDF at the bottom of the developers lounge web page? --------------------------------------------------------------------------- Adam Witney wrote: > Hi, > > I am trying to optimise a complex query adding explicit joins and creating > indices. I am going through the EXPLAIN output (~70 lines) but am fairly new > at reading these. > > Are there any good rules of thumb of things one should be looking out for in > EXPLAIN output? ie means that an index would be good here etc > > I have read through the docs for EXPLAIN, but I was wondering if there were > any more detailed descriptions or docs on the subject. > > Thanks for any help > > adam > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Thu Oct 10 12:59:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 03F4F475D0D for ; Thu, 10 Oct 2002 12:59:19 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 67C10475CA9 for ; Thu, 10 Oct 2002 12:59:18 -0400 (EDT) Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1780475; Thu, 10 Oct 2002 09:59:18 -0700 From: "Josh Berkus" Subject: Re: Info on explain output To: Bruce Momjian , Adam Witney Cc: pgsql-performance X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Thu, 10 Oct 2002 09:59:18 -0700 Message-ID: In-Reply-To: <200210101644.g9AGi1F17476@candle.pha.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/93 X-Sequence-Number: 110 Adam, > > Are there any good rules of thumb of things one should be looking > out for in > > EXPLAIN output? ie means that an index would be good here > etc Also try: 1) Various articles on Techdocs.postgresql.org 2) Ewald G.'s PostgreSQL Book Explain output is not that easily converted into a plan of action ... otherwise, Postgres would have automated it, neh? You have to get a feel for what looks good and bad dynamically. -Josh Berkus From pgsql-performance-owner@postgresql.org Fri Oct 11 03:14:49 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 872C947590C; Fri, 11 Oct 2002 03:14:46 -0400 (EDT) Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id 3499A474E5C; Fri, 11 Oct 2002 03:14:45 -0400 (EDT) Received: from 10.192.17.128 ([10.192.17.128]) by relay.icomedias.com (8.12.5/8.12.5) with ESMTP id g9B7Egcj021890; Fri, 11 Oct 2002 09:14:43 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Mario Weilguni To: pgsql-performance@postgresql.org Subject: number of attributes in page files? Date: Fri, 11 Oct 2002 09:14:50 +0200 User-Agent: KMail/1.4.3 Cc: pgsql-hackers@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210110914.50377.mweilguni@sime.com> avpresult: 0, ok, ok X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/94 X-Sequence-Number: 111 Is it possible to get rid of the "t_natts" fields in the tuple header? Is t= his field only for "alter table add/drop" support? Then it might possible to get rid of it and put the "t_natts" field in the page header, n= ot the tuple header, if it can be assured that when updating/inserting records only a compatible (a page file with the same number of attributes) = page file is used. Especially master-detail tables would=20 profit from this, reducing the tuple overhead by another 9%. Might this be possible? Regards, Mario Weilguni From pgsql-performance-owner@postgresql.org Fri Oct 11 04:43:59 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 827DE475F63 for ; Fri, 11 Oct 2002 04:43:57 -0400 (EDT) Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id 450C5475F34 for ; Fri, 11 Oct 2002 04:43:55 -0400 (EDT) Received: from 10.192.17.128 ([10.192.17.128]) by relay.icomedias.com (8.12.5/8.12.5) with ESMTP id g9B8htcj022876 for ; Fri, 11 Oct 2002 10:43:55 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Mario Weilguni To: pgsql-performance@postgresql.org Subject: Compile test with gcc 3.2 Date: Fri, 11 Oct 2002 10:44:03 +0200 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210111044.03361.mweilguni@sime.com> avpresult: 0, ok, ok X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/95 X-Sequence-Number: 112 If you want to get the max (CPU) performance and use gcc, you should give t= he -fprofile-arcs / -fbranch-probabilties options of gcc 3.2 a try.=20 For 50 pgbench read-only runs (1 mio tuples, 40000 txs, 10 clients) I get 1= 4.4% speedup.=20 Then I tried it with real data from our production system. This is 2GB data, 120 tables, but most of the data is large object data (1.= 8GB), so most tables of the database are in-memory and the application is = more cpu bound. With this scenario, I still get 8% improvement.=20 All tests done on an Athlon XP/1500, 768MB RAM, Linux 2.4.19, gcc 3.2, 5400= RPM Maxtor. Might be worth a try. Probably the performance win will be smaller for larg= er databases. Regards, Mario Weilguni From pgsql-performance-owner@postgresql.org Fri Oct 11 08:12:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2D8F44766CB; Fri, 11 Oct 2002 08:12:49 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 4829D47675B; Fri, 11 Oct 2002 08:12:48 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9BCCohR004296; Fri, 11 Oct 2002 08:12:51 -0400 (EDT) To: Mario Weilguni Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [HACKERS] number of attributes in page files? In-reply-to: <200210110914.50377.mweilguni@sime.com> References: <200210110914.50377.mweilguni@sime.com> Comments: In-reply-to Mario Weilguni message dated "Fri, 11 Oct 2002 09:14:50 +0200" Date: Fri, 11 Oct 2002 08:12:50 -0400 Message-ID: <4295.1034338370@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/96 X-Sequence-Number: 113 Mario Weilguni writes: > Is it possible to get rid of the "t_natts" fields in the tuple header? > Is this field only for "alter table add/drop" support? "Only"? A lot of people consider that pretty important ... But removing 2 bytes isn't going to save anything, on most machines, because of alignment considerations. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Oct 11 10:00:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0096E475EAA; Fri, 11 Oct 2002 10:00:05 -0400 (EDT) Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id 8B3F1475E8A; Fri, 11 Oct 2002 10:00:03 -0400 (EDT) Received: from 10.192.17.128 ([10.192.17.128]) by relay.icomedias.com (8.12.5/8.12.5) with ESMTP id g9BE05cj027587; Fri, 11 Oct 2002 16:00:05 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Mario Weilguni To: Tom Lane Subject: Re: [HACKERS] number of attributes in page files? Date: Fri, 11 Oct 2002 16:00:13 +0200 User-Agent: KMail/1.4.3 Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org References: <200210110914.50377.mweilguni@sime.com> <4295.1034338370@sss.pgh.pa.us> In-Reply-To: <4295.1034338370@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210111600.13876.mweilguni@sime.com> avpresult: 0, ok, ok X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/97 X-Sequence-Number: 114 Am Freitag, 11. Oktober 2002 14:12 schrieb Tom Lane: > Mario Weilguni writes: > > Is it possible to get rid of the "t_natts" fields in the tuple header? > > Is this field only for "alter table add/drop" support? > > "Only"? A lot of people consider that pretty important ... With "only" I mean it's an administrative task which requires operator inte= rvenation anyways, and it's a seldom needed operation which may take longer= , when queries become faster. > > But removing 2 bytes isn't going to save anything, on most machines, > because of alignment considerations. ok, I did not consider alignment, but the question remains, is this easily = doable? Especially because only one another byte has to be saved for real saving on many architectures, which is t_hoff. IMO t_hoff is not usefu= l because it can be computed easily. This would give 20 byte headers instea= d of 23 (24) bytes as it's now.=20 This is 17% saved, and if it's not too complicated it might be worth to con= sider. Best regards, Mario Weilguni From pgsql-performance-owner@postgresql.org Fri Oct 11 10:34:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D6681476103 for ; Fri, 11 Oct 2002 10:34:54 -0400 (EDT) Received: from web80307.mail.yahoo.com (web80307.mail.yahoo.com [66.218.79.23]) by postgresql.org (Postfix) with SMTP id D7E9B4760AB for ; Fri, 11 Oct 2002 10:34:53 -0400 (EDT) Message-ID: <20021011143458.48739.qmail@web80307.mail.yahoo.com> Received: from [210.23.216.156] by web80307.mail.yahoo.com via HTTP; Fri, 11 Oct 2002 07:34:58 PDT Date: Fri, 11 Oct 2002 07:34:58 -0700 (PDT) From: Ludwig Lim Subject: Re: Compile test with gcc 3.2 To: Mario Weilguni Cc: PostgreSQL Mailing List In-Reply-To: <200210111044.03361.mweilguni@sime.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/98 X-Sequence-Number: 115 Hi Mario: --- Mario Weilguni wrote: > If you want to get the max (CPU) performance and use > gcc, you should give the -fprofile-arcs / > -fbranch-probabilties options of gcc 3.2 a try. > For 50 pgbench read-only runs (1 mio tuples, 40000 > txs, 10 clients) I get 14.4% speedup. > > Then I tried it with real data from our production > system. > This is 2GB data, 120 tables, but most of the data > is large object data (1.8GB), so most tables of the > database are in-memory and the application is more > cpu bound. > With this scenario, I still get 8% improvement. > > All tests done on an Athlon XP/1500, 768MB RAM, > Linux 2.4.19, gcc 3.2, 5400 RPM Maxtor. > > Might be worth a try. Probably the performance win > will be smaller for larger databases. - Do you use the "-fprofile-arcs -fbranch-probabilties" options with other optimization flags? I've in a book (Optimimizing Red Hat Linux 6.2) that one could also optimize speed by setting the CFLAGS to the following : " -02 -fomit-frame-pointers -funroll-loops" and running "strip" on the on binaries after they are compiled. regards, ludwig. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From pgsql-performance-owner@postgresql.org Fri Oct 11 12:01:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 80F57475F1B; Fri, 11 Oct 2002 12:01:38 -0400 (EDT) Received: from kumudu.nslk.com (kumudu.nslk.com [64.247.55.254]) by postgresql.org (Postfix) with ESMTP id F1B7A475EF7; Fri, 11 Oct 2002 12:01:37 -0400 (EDT) Received: from [203.94.89.226] (helo=W) by kumudu.nslk.com with asmtp (Exim 3.36 #1) id 1802EM-00072v-00; Fri, 11 Oct 2002 12:01:39 -0400 Message-ID: <008c01c2713f$a86eb0a0$e2595ecb@A.GEEKIYANAGE> Reply-To: "Waruna Geekiyanage" From: "Waruna Geekiyanage" To: Cc: Subject: syncronize databases Date: Fri, 11 Oct 2002 22:02:31 +0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0089_01C27171.E5414BA0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - kumudu.nslk.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [0 0] X-AntiAbuse: Sender Address Domain - nirmani.com X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/99 X-Sequence-Number: 116 This is a multi-part message in MIME format. ------=_NextPart_000_0089_01C27171.E5414BA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I need to syncronize two pgsql databases runing on RedHat linux7.2. One is on our LAN and other one on the internet which we connect through a = dialup connection. Waruna ------=_NextPart_000_0089_01C27171.E5414BA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I need to syncronize two pgsql databases r= uning on=20 RedHat linux7.2.
One is on our LAN and other one on the int= ernet=20 which we connect through a dialup connection.
 
Waruna
------=_NextPart_000_0089_01C27171.E5414BA0-- From pgsql-performance-owner@postgresql.org Fri Oct 11 15:23:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F0A434768C1 for ; Fri, 11 Oct 2002 15:23:55 -0400 (EDT) Received: from absinthe.carnagecopia.com (absinthe.carnagecopia.com [216.187.87.246]) by postgresql.org (Postfix) with SMTP id 1DBE247668C for ; Fri, 11 Oct 2002 15:23:55 -0400 (EDT) Received: (qmail 71289 invoked by uid 85); 11 Oct 2002 19:23:50 -0000 Received: from random@goblinstudios.com by absinthe.carnagecopia.com with qmail-scanner-1.03 (uvscan: v4.1.60/v4228. . Clean. Processed in 0.383563 secs); 11 Oct 2002 19:23:50 -0000 Received: from unknown (HELO workstation-22.internal.carnagecopia.com) (204.244.192.2) by absinthe.carnagecopia.com with SMTP; 11 Oct 2002 19:23:50 -0000 Date: Fri, 11 Oct 2002 15:24:29 -0400 From: Vincent Janelle To: Ludwig Lim Cc: mweilguni@sime.com, pgsql-performance@postgresql.org Subject: Re: Compile test with gcc 3.2 Message-Id: <20021011152429.6ef918d1.random@goblinstudios.com> In-Reply-To: <20021011143458.48739.qmail@web80307.mail.yahoo.com> References: <200210111044.03361.mweilguni@sime.com> <20021011143458.48739.qmail@web80307.mail.yahoo.com> Organization: http://www.goblinstudios.com/ X-Mailer: Sylpheed version 0.8.1 (GTK+ 1.2.10; i586-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/100 X-Sequence-Number: 117 except when you run the regression tests you get some very interesting results. On Fri, 11 Oct 2002 07:34:58 -0700 (PDT) Ludwig Lim wrote: > > - Do you use the "-fprofile-arcs > -fbranch-probabilties" options with other optimization > flags? I've in a book (Optimimizing Red Hat Linux 6.2) > that one could also optimize speed by setting the > CFLAGS to the following : > " -02 -fomit-frame-pointers -funroll-loops" and > running "strip" on the on binaries after they are > compiled. > From pgsql-performance-owner@postgresql.org Wed Oct 16 14:02:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8B0F3475E8A for ; Wed, 16 Oct 2002 14:02:22 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id EA7F8475DF2 for ; Wed, 16 Oct 2002 14:02:21 -0400 (EDT) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1788844 for pgsql-performance@postgresql.org; Wed, 16 Oct 2002 11:02:59 -0700 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: PG_Autotune 0.1 Date: Tue, 15 Oct 2002 11:00:58 -0700 X-Mailer: KMail [version 1.4] MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210151100.58044.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/101 X-Sequence-Number: 118 Folks, Justin, Hey, I've been tinkering with PG_autotune in an effort to make it usable on= my=20 installation.=20=20=20 http://gborg.postgresql.org/project/pgautotune/projdisplay.php First off, thank you Justin for getting inspired and writing the starter=20 version. This is something that would probably have remained *way* down t= he=20 Postgres TODO list, were it not for you.=20 Since it's such a great idea, I'd like to make it bulletproof so that it ca= n=20 become part of the standard Postgres distribution. I'm hoping that people= =20 on this list can help. Problems, Bugs, & Suggestions: 1) The program makes the assumption that the Postgres superuser is named=20 "pgsql", forcing me to do a search-and-replace on the source to make it wor= k=20 at all on my system, where the superuser is named "postgres". This should= =20 be a configuration option. Places I've identified where this is an issue:= =20=20 a. the connection to the "metrics" database, b. the calls to Postgres=20 executables (which are also sometimes made as the console user, causing the= m=20 to fail if you run the program as "root"). 2) The program also assumes that all Postgres binaries are symlinked in=20 /usr/local/bin. Since this symlinking isn't done by Postgres-make-instal= l,=20 wouldn't it be better to reference $PGHOME/bin?=20=20=20 3) For that matter, it would be nice if the program would test $PGDATA and= =20 $PGHOME, and prompt the user if they are empty. 4) The shell scripts need to have error-checking so that they exit if anyth= ing=20 blows up. I can write this if Justin can explain what the shell scripts a= re=20 supposed to do, exactly, and where errors are acceptable. 5) We need installation docs. I can write these. Sometime soon, really! Questions & Suggestions for Enhancement: 6) The shared_buffers param is capped at 500. Isn't this awfully low for a= =20 production server? What's the logic here? 7) Any ideas on how to get around/adjust memory maximums for the host OS?= =20=20 This is easy on Linux, but other *nixes are not so easy. 8) What will be the difficulties in expanding the script to adjust more=20 Postgresql.conf params, such as checkpoint_segments? Can we use feedback= =20 from the log to adjust these? 9) I *love* the idea of letting the benchmarking script run custom queries.= =20=20=20 However, I would dearly like to expand it, letting it randomly grab from a= =20 list of 10 custom queries entered by the user into a file or files. This= =20 would allow the user to create a realistic mix of simple and complex querie= s,=20 including some data manipulation and procedures. 10) Can we eventually adjust the program to get feedback from system tools = and=20 give the user hints on hardware limitations? For example, have the program= =20 test if, at maximum settings, queries are slow but CPU and RAM are only 10%= =20 utilized and tell the user "Your hard drives are probably too slow"? I can help with: documentation, shell scripting, Linux system issues. Oth= er=20 volunteers to help? --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Oct 17 10:44:57 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0D7A24762A1 for ; Thu, 17 Oct 2002 10:44:55 -0400 (EDT) Received: from utahisp.com (unknown [66.239.12.3]) by postgresql.org (Postfix) with ESMTP id BCAF74761C6 for ; Thu, 17 Oct 2002 10:44:53 -0400 (EDT) Received: from chad [63.230.8.76] by utahisp.com (SMTPD32-5.05) id AC881A1D03B6; Thu, 17 Oct 2002 08:43:20 -0600 Message-ID: <068c01c275eb$c9ba4f70$32021aac@chad> From: "Chad Thompson" To: "pgsql-performance" Subject: Max time queries Date: Thu, 17 Oct 2002 08:45:07 -0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0689_01C275B9.7E6D0A30" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Declude-Sender: chad@weblinkservices.com [63.230.8.76] X-Note: This E-mail was scanned by Declude JunkMail (www.declude.com) for spam. X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/102 X-Sequence-Number: 119 This is a multi-part message in MIME format. ------=_NextPart_000_0689_01C275B9.7E6D0A30 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Heres an oddity. Why would it take more time to not find an answer than it= would to find one?=20=20 Here are my 2 queries. The Cold Fusion output of the query is followed by an explain analyze. maxTime (Records=3D0, Time=3D2223ms) SQL =3D=20 select cr.start_time as max from call_results cr, timezone tz, lists l where (cr.start_time between '10/15/2002 08:00' and '10/15/2002 23:00') and l.full_phone =3D cr.phonenum and l.area_code =3D tz.area_code and tz.greenwich =3D '-7' and cr.project_id =3D 11 and l.client_id =3D 8=20 order by cr.start_time desc limit 1 NOTICE: QUERY PLAN: Limit (cost=3D0.00..1544.78 rows=3D1 width=3D49) (actual time=3D2299.11..2= 299.11 rows=3D0 loops=3D1) -> Nested Loop (cost=3D0.00..1266550.38 rows=3D820 width=3D49) (actual = time=3D2299.10..2299.10 rows=3D0 loops=3D1) -> Nested Loop (cost=3D0.00..776978.04 rows=3D90825 width=3D42) (= actual time=3D0.84..1849.97 rows=3D9939 loops=3D1) -> Index Scan Backward using start_time_idx on call_results = cr (cost=3D0.00..6569.39 rows=3D6693 width=3D22) (actual time=3D0.38..303.= 58 rows=3D9043 loops=3D1) -> Index Scan using full_phone_idx on lists l (cost=3D0.00.= .114.94 rows=3D14 width=3D20) (actual time=3D0.15..0.16 rows=3D1 loops=3D90= 43) -> Index Scan using area_code_idx on timezone tz (cost=3D0.00..5.= 38 rows=3D1 width=3D7) (actual time=3D0.04..0.04 rows=3D0 loops=3D9939) Total runtime: 2300.55 msec maxTime (Records=3D1, Time=3D10ms) SQL =3D=20 select cr.start_time as max from call_results cr, timezone tz, lists l where (cr.start_time between '10/15/2002 08:00' and '10/15/2002 23:00') and l.full_phone =3D cr.phonenum and l.area_code =3D tz.area_code and tz.greenwich =3D '-8' and cr.project_id =3D 11 and l.client_id =3D 8=20 order by cr.start_time desc limit 1 NOTICE: QUERY PLAN: Limit (cost=3D0.00..331.03 rows=3D1 width=3D49) (actual time=3D1.19..1.53 = rows=3D1 loops=3D1) -> Nested Loop (cost=3D0.00..1266550.38 rows=3D3826 width=3D49) (actual= time=3D1.19..1.52 rows=3D2 loops=3D1) -> Nested Loop (cost=3D0.00..776978.04 rows=3D90825 width=3D42) (= actual time=3D0.84..1.10 rows=3D2 loops=3D1) -> Index Scan Backward using start_time_idx on call_results = cr (cost=3D0.00..6569.39 rows=3D6693 width=3D22) (actual time=3D0.39..0.48= rows=3D2 loops=3D1) -> Index Scan using full_phone_idx on lists l (cost=3D0.00.= .114.94 rows=3D14 width=3D20) (actual time=3D0.30..0.30 rows=3D1 loops=3D2) -> Index Scan using area_code_idx on timezone tz (cost=3D0.00..5.= 38 rows=3D1 width=3D7) (actual time=3D0.19..0.20 rows=3D1 loops=3D2) Total runtime: 1.74 msec ------=_NextPart_000_0689_01C275B9.7E6D0A30 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Heres an oddity.  Why would it take more time to not find an answ= er=20 than it would to find one? 
Here are my 2 queries.
The Cold Fusion output of the query is fol= lowed by=20 an explain analyze.
 
maxTime (Records=3D0, Time=3D2223ms)
SQL =3D
s= elect=20 cr.start_time as max
from call_results cr, timezone tz, lists=20 l
where (cr.start_time between '10/15/2002 08:00' and '10/15/2002=20 23:00')
and l.full_phone =3D cr.phonenum
and l.area_code =3D= =20 tz.area_code
and tz.greenwich =3D '-7'
and cr.project_id =3D= =20 11
and l.client_id =3D 8
order by cr.start_time desc
= limit=20 1
 
NOTICE:  QUERY PLAN:
 
Limit  (cost=3D0.00..1544.78 rows=3D1= width=3D49)=20 (actual time=3D2299.11..2299.11 rows=3D0 loops=3D1)
  ->  N= ested=20 Loop  (cost=3D0.00..1266550.38 rows=3D820 width=3D49) (actual=20 time=3D2299.10..2299.10 rows=3D0=20 loops=3D1)
        ->  Nested= =20 Loop  (cost=3D0.00..776978.04 rows=3D90825 width=3D42) (actual time=3D= 0.84..1849.97=20 rows=3D9939=20 loops=3D1)
          &= nbsp;  =20 ->  Index Scan Backward using start_time_idx on call_results cr&nbs= p;=20 (cost=3D0.00..6569.39 rows=3D6693 width=3D22) (actual time=3D0.38..303.58 r= ows=3D9043=20 loops=3D1)
          &= nbsp;  =20 ->  Index Scan using full_phone_idx on lists l  (cost=3D0.00..= 114.94=20 rows=3D14 width=3D20) (actual time=3D0.15..0.16 rows=3D1=20 loops=3D9043)
        ->  Ind= ex Scan=20 using area_code_idx on timezone tz  (cost=3D0.00..5.38 rows=3D1 width= =3D7)=20 (actual time=3D0.04..0.04 rows=3D0 loops=3D9939)
Total runtime: 2300.55= =20 msec

maxTime (Records=3D1, Time=3D10ms)
SQL =3D select=20 cr.start_time as max
from call_results cr, timezone tz, lists=20 l
where (cr.start_time between '10/15/2002 08:00' and '10/15/2002=20 23:00')
and l.full_phone =3D cr.phonenum
and l.area_code =3D= =20 tz.area_code
and tz.greenwich =3D '-8'
and cr.project_id =3D= =20 11
and l.client_id =3D 8
order by cr.start_time desc
= limit=20 1
 NOTICE:  QUERY PLAN:
 
Limit  (cost=3D0.00..331.03 rows=3D1 width=3D49) (actual time=3D1= .19..1.53=20 rows=3D1 loops=3D1)
  ->  Nested Loop  (cost=3D0.00..1= 266550.38=20 rows=3D3826 width=3D49) (actual time=3D1.19..1.52 rows=3D2=20 loops=3D1)
        ->  Nested= =20 Loop  (cost=3D0.00..776978.04 rows=3D90825 width=3D42) (actual time=3D= 0.84..1.10=20 rows=3D2=20 loops=3D1)
          &= nbsp;  =20 ->  Index Scan Backward using start_time_idx on call_results cr&nbs= p;=20 (cost=3D0.00..6569.39 rows=3D6693 width=3D22) (actual time=3D0.39..0.48 row= s=3D2=20 loops=3D1)
          &= nbsp;  =20 ->  Index Scan using full_phone_idx on lists l  (cost=3D0.00..= 114.94=20 rows=3D14 width=3D20) (actual time=3D0.30..0.30 rows=3D1=20 loops=3D2)
        ->  Index = Scan=20 using area_code_idx on timezone tz  (cost=3D0.00..5.38 rows=3D1 width= =3D7)=20 (actual time=3D0.19..0.20 rows=3D1 loops=3D2)
Total runtime: 1.74=20 msec
------=_NextPart_000_0689_01C275B9.7E6D0A30-- From pgsql-performance-owner@postgresql.org Thu Oct 17 21:37:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B9C6947687B for ; Thu, 17 Oct 2002 21:37:24 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id E4C3A47687A for ; Thu, 17 Oct 2002 21:37:23 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9I1bRhR013381; Thu, 17 Oct 2002 21:37:27 -0400 (EDT) To: "Chad Thompson" Cc: "pgsql-performance" Subject: Re: Max time queries In-reply-to: <068c01c275eb$c9ba4f70$32021aac@chad> References: <068c01c275eb$c9ba4f70$32021aac@chad> Comments: In-reply-to "Chad Thompson" message dated "Thu, 17 Oct 2002 08:45:07 -0600" Date: Thu, 17 Oct 2002 21:37:27 -0400 Message-ID: <13380.1034905047@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/103 X-Sequence-Number: 120 "Chad Thompson" writes: > Heres an oddity. Why would it take more time to not find an answer than it > would to find one? Because the successful query stops as soon as it's exhausted the LIMIT (ie, after it's found the first matching combination of rows). The failing query has to run through the whole tables looking in vain for a match. Note the difference in number of rows scanned in the lower levels of your query. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Oct 21 02:23:35 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C01EC475D00 for ; Mon, 21 Oct 2002 02:23:33 -0400 (EDT) Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id 9D1DA475A9E for ; Mon, 21 Oct 2002 02:23:31 -0400 (EDT) Received: from 10.192.17.128 ([10.192.17.128]) by relay.icomedias.com (8.12.5/8.12.5) with ESMTP id g9L6NQcj021530 for ; Mon, 21 Oct 2002 08:23:27 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Mario Weilguni To: pgsql-performance@postgresql.org Subject: Self-generating statistics? Date: Mon, 21 Oct 2002 08:23:33 +0200 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210210823.33744.mweilguni@sime.com> avpresult: 0, ok, ok X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/104 X-Sequence-Number: 121 Something that might be worth considering: Many of the performance problems on pgsql-general seem to be related to the= fact that no analyze is performed after the creation on the tables, so maybe this might be an option to fix that (in future releases): when a tabl= e has no statistics at all, and the first seq-scan on the table is performed, it might improve further performance if this seq-scan is used to= get table statistics too. This should not be too expensive since reading t= he table has to be done only once. Further queries will have at least prelimin= ary statistics at hand. I'm not sure how (CPU) expensive statistic-gathering is, but if most of the= work is reading the tuples, it might be a win to do this. Regards, Mario Weilguni From pgsql-performance-owner@postgresql.org Mon Oct 21 03:05:00 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 837AF475956 for ; Mon, 21 Oct 2002 03:04:58 -0400 (EDT) Received: from web80305.mail.yahoo.com (web80305.mail.yahoo.com [66.218.79.21]) by postgresql.org (Postfix) with SMTP id B71E4475461 for ; Mon, 21 Oct 2002 03:04:57 -0400 (EDT) Message-ID: <20021021070458.3513.qmail@web80305.mail.yahoo.com> Received: from [203.87.150.116] by web80305.mail.yahoo.com via HTTP; Mon, 21 Oct 2002 00:04:58 PDT Date: Mon, 21 Oct 2002 00:04:58 -0700 (PDT) From: Ludwig Lim Subject: Default cost variables in postgresql.conf To: PostgreSQL Mailing List MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/105 X-Sequence-Number: 122 Hi: Are the "cost" variables (e.g. random_page_cost,cpu_tuple_cost,cpu_index_tuple_cost) in postgresql.conf optimal for a particular set of platform / hardware requirements? (i.e. the configs works best for let say if you have PIII computer w/ IDE as storage). I'm asking this since a lot of softwares' configs are defaulted to a "conservative" settings where allowances are given for people who have older/slower CPUs(w/ not so large amount of memory). Thank you in advance. ludwig. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From pgsql-performance-owner@postgresql.org Mon Oct 21 03:36:07 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E20EF475FB9 for ; Mon, 21 Oct 2002 03:36:04 -0400 (EDT) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by postgresql.org (Postfix) with ESMTP id 70A01476238 for ; Mon, 21 Oct 2002 03:35:38 -0400 (EDT) Received: from tokyo.samurai.com (DU150.N224.ResNet.QueensU.CA [130.15.224.150]) by bob.samurai.com (Postfix) with ESMTP id DAE351D46; Mon, 21 Oct 2002 03:35:28 -0400 (EDT) To: Mario Weilguni Cc: pgsql-performance@postgresql.org Subject: Re: Self-generating statistics? References: <200210210823.33744.mweilguni@sime.com> From: Neil Conway In-Reply-To: <200210210823.33744.mweilguni@sime.com> Date: 21 Oct 2002 03:34:56 -0400 Message-ID: <87y98sz1lr.fsf@mailbox.samurai.com> Lines: 27 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/106 X-Sequence-Number: 123 Mario Weilguni writes: > Many of the performance problems on pgsql-general seem to be related > to the fact that no analyze is performed after the creation on the > tables Well, there are lots of other ways an incompetent DBA can screw up a database. The need to VACUUM and ANALYZE is stated clearly in the docs. Providing workarounds for negligence isn't the right path to get started down, IMHO. That said, the general idea of a self-tuning database system has merit, IMHO. For example, this paper proposes a histogram data structure that can be updated fairly cheaply based on data gathered from query execution: http://citeseer.nj.nec.com/255752.html A bunch of industry players (IBM, Microsoft, etc.) are putting some work into this area (IBM calls it "autonomic computing", for example). It might be an interesting area to look at in the future... Cheers, Neil -- Neil Conway || PGP Key ID: DB3C29FC From pgsql-performance-owner@postgresql.org Mon Oct 21 09:00:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B2A4C475BEC for ; Mon, 21 Oct 2002 09:00:22 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id A7A66475ADE for ; Mon, 21 Oct 2002 09:00:21 -0400 (EDT) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 183cAT-00049D-00 for ; Mon, 21 Oct 2002 09:00:25 -0400 Date: Mon, 21 Oct 2002 09:00:25 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Self-generating statistics? Message-ID: <20021021090025.B14840@mail.libertyrms.com> Mail-Followup-To: pgsql-performance@postgresql.org References: <200210210823.33744.mweilguni@sime.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200210210823.33744.mweilguni@sime.com>; from mweilguni@sime.com on Mon, Oct 21, 2002 at 08:23:33AM +0200 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/107 X-Sequence-Number: 124 On Mon, Oct 21, 2002 at 08:23:33AM +0200, Mario Weilguni wrote: > Something that might be worth considering: > > Many of the performance problems on pgsql-general seem to be > related to the fact that no analyze is performed after the creation > on the tables, so maybe this might be an option to fix that (in > future releases): when a table has no statistics at all, and the > first seq-scan on the table is It's never the case that a table has no statistics at all. It has default ones. Maybe they're right; it's hard to know. Someone has posted on gborg an anto-vacuum daemon that might be of use in this situation. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Oct 21 10:28:47 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BC2E14766BC for ; Mon, 21 Oct 2002 10:17:37 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id B2468476E4C for ; Mon, 21 Oct 2002 10:16:16 -0400 (EDT) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 183dLx-0005Go-00 for ; Mon, 21 Oct 2002 10:16:21 -0400 Date: Mon, 21 Oct 2002 10:16:21 -0400 From: Andrew Sullivan To: PostgreSQL Mailing List Subject: Re: Default cost variables in postgresql.conf Message-ID: <20021021101621.A19970@mail.libertyrms.com> Mail-Followup-To: PostgreSQL Mailing List References: <20021021070458.3513.qmail@web80305.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20021021070458.3513.qmail@web80305.mail.yahoo.com>; from lud_nowhere_man@yahoo.com on Mon, Oct 21, 2002 at 12:04:58AM -0700 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/108 X-Sequence-Number: 125 On Mon, Oct 21, 2002 at 12:04:58AM -0700, Ludwig Lim wrote: > Hi: > > Are the "cost" variables (e.g. > random_page_cost,cpu_tuple_cost,cpu_index_tuple_cost) > in postgresql.conf optimal for a particular set of > platform / hardware requirements? (i.e. the configs Not exactly. They're best guesses. If you check the admin guide, you'll see that there's a note about these which says that there is not a well-defined method for calculating these things, so you are encouraged to experiment and share your findings. They _are_ known to be conservative defaults, like everything else in the system. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Oct 22 07:47:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 46E4C475C26 for ; Tue, 22 Oct 2002 07:47:36 -0400 (EDT) Received: from web80303.mail.yahoo.com (web80303.mail.yahoo.com [66.218.79.19]) by postgresql.org (Postfix) with SMTP id A6FB347592C for ; Tue, 22 Oct 2002 07:47:35 -0400 (EDT) Message-ID: <20021022114738.77366.qmail@web80303.mail.yahoo.com> Received: from [203.87.150.116] by web80303.mail.yahoo.com via HTTP; Tue, 22 Oct 2002 04:47:38 PDT Date: Tue, 22 Oct 2002 04:47:38 -0700 (PDT) From: Ludwig Lim Subject: Selective usage of index in planner/optimizer (Too conservative?) To: PostgreSQL Mailing List MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/109 X-Sequence-Number: 126 Hi: I was testing a database when notice that it does not used the new index I created. So after a couple of VACUUM ANALYZE it tried the following test queries. **** TEST CASE #1 *********** loyalty=# set enable_seqscan=off; SET VARIABLE loyalty=# explain analyze select count(*) from points where branch_cd=1 ; NOTICE: QUERY PLAN: Aggregate (cost=119123.54..119123.54 rows=1 width=0) (actual time=811.08..811.0 8 rows=1 loops=1) -> Index Scan using idx_monthly_branch on points (cost=0.00..1187 65.86 rows=143073 width=0) (actual time=0.19..689.75 rows=136790 loops=1) Total runtime: 811.17 msec ***** TEST CASE #2 ********* loyalty=# set enable_seqscan=on; SET VARIABLE loyalty=# explain analyze select count(*) from points where branch_cd=1 ; NOTICE: QUERY PLAN: Aggregate (cost=62752.34..62752.34 rows=1 width=0) (actual time=3593.93..3593.9 3 rows=1 loops=1) -> Seq Scan on points (cost=0.00..62681.70 rows=28254 width=0) (a ctual time=0.33..3471.54 rows=136790 loops=1) Total runtime: 3594.01 msec *** TEST CASE #3 (Sequential scan turned off) ****** loyalty=# explain select * from points where branch_cd=5; NOTICE: QUERY PLAN: Index Scan using idx_monthly_branch on points (cost=0.00..49765.12 r ows=16142 width=55) I am wondering why in test case #2 it did not use an index scan, where as in case #3 it did. The number of rows in test #2 and #3 are just a small subset of table "points". The following are the number of elements in the table: branch_cd = 1 ---> 136,970 branch_cd = 5 ---> 39,385 count(*) ---> 2,570,173 Its rather strange why "SELECT COUNT(*)...WHERE branch_cd=1" uses sequential scan even though it just comprises 5.3% of whole table... I'ts also strange because of the ff: (Remember test case 1 and 2 are the same query) test 1 --> seq_scan=off --> 811.17 msec test 2 --> seq_scan=on --> 3594.01 msec Test #1 have 400% improvement over Test #2, yet the query plan for test #2 is the default. Are there way to let the planner improve the choice in using an index or not? BTW the "cost" variables are set to the default for the test. Thank you in advance. ludwig. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From pgsql-performance-owner@postgresql.org Tue Oct 22 10:24:22 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7200547667E for ; Tue, 22 Oct 2002 10:24:21 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id BBF11476678 for ; Tue, 22 Oct 2002 10:24:20 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9MEOOhR018688; Tue, 22 Oct 2002 10:24:25 -0400 (EDT) To: Ludwig Lim Cc: PostgreSQL Mailing List Subject: Re: Selective usage of index in planner/optimizer (Too conservative?) In-reply-to: <20021022114738.77366.qmail@web80303.mail.yahoo.com> References: <20021022114738.77366.qmail@web80303.mail.yahoo.com> Comments: In-reply-to Ludwig Lim message dated "Tue, 22 Oct 2002 04:47:38 -0700" Date: Tue, 22 Oct 2002 10:24:24 -0400 Message-ID: <18687.1035296664@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/110 X-Sequence-Number: 127 Ludwig Lim writes: > NOTICE: QUERY PLAN: > Aggregate (cost=119123.54..119123.54 rows=1 width=0) > (actual time=811.08..811.0 > 8 rows=1 loops=1) > -> Index Scan using idx_monthly_branch on points > (cost=0.00..1187 > 65.86 rows=143073 width=0) (actual time=0.19..689.75 > rows=136790 loops=1) > Total runtime: 811.17 msec > NOTICE: QUERY PLAN: > Aggregate (cost=62752.34..62752.34 rows=1 width=0) > (actual time=3593.93..3593.9 > 3 rows=1 loops=1) > -> Seq Scan on points (cost=0.00..62681.70 > rows=28254 width=0) (a > ctual time=0.33..3471.54 rows=136790 loops=1) > Total runtime: 3594.01 msec Something fishy about this --- why is the estimated number of rows different in the two cases (143073 vs 28254)? Did you redo VACUUM and/or ANALYZE in between? > I am wondering why in test case #2 it did not use > an index scan, where as in case #3 it did. Probably because it knows "branch_cd=5" is more selective than "branch_cd=1". It would be useful to see the pg_stats entry for branch_cd. > Its rather strange why "SELECT COUNT(*)...WHERE > branch_cd=1" uses sequential scan even though it just > comprises 5.3% of whole table... No, what's strange is that it's faster to use an indexscan for that. The table must be very nearly in order by branch_cd; have you clustered it recently? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Oct 22 21:48:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7F9F547610B for ; Tue, 22 Oct 2002 21:48:01 -0400 (EDT) Received: from web80310.mail.yahoo.com (web80310.mail.yahoo.com [66.218.79.26]) by postgresql.org (Postfix) with SMTP id B3FAF4760AA for ; Tue, 22 Oct 2002 21:48:00 -0400 (EDT) Message-ID: <20021023014804.72515.qmail@web80310.mail.yahoo.com> Received: from [203.87.150.116] by web80310.mail.yahoo.com via HTTP; Tue, 22 Oct 2002 18:48:04 PDT Date: Tue, 22 Oct 2002 18:48:04 -0700 (PDT) From: Ludwig Lim Subject: Re: Selective usage of index in planner/optimizer (Too conservative?) To: Tom Lane Cc: PostgreSQL Mailing List In-Reply-To: <18687.1035296664@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/111 X-Sequence-Number: 128 --- Tom Lane wrote: > > Something fishy about this --- why is the estimated > number of rows > different in the two cases (143073 vs 28254)? Did > you redo VACUUM > and/or ANALYZE in between? I neither VACUUMed nor ANALYZEd between the 2 cases. > > > I am wondering why in test case #2 it did not > use > > an index scan, where as in case #3 it did. > > Probably because it knows "branch_cd=5" is more > selective than > "branch_cd=1". It would be useful to see the > pg_stats entry for > branch_cd. Should I try altering the statistics? I tried ANALYZE points(branch_cd); but it still gave me the same results. > > Its rather strange why "SELECT COUNT(*)...WHERE > > branch_cd=1" uses sequential scan even though it > just > > comprises 5.3% of whole table... What I mean is the table is rather large. (2 million rows) and I thought the planner would automatically used an index to retrieve a small subset (based on the percentage) of the large table. > No, what's strange is that it's faster to use an > indexscan for that. > The table must be very nearly in order by branch_cd; > have you clustered > it recently? I never clustered the table. But prior to testing I dropped an index and create a new one. Does dropping and creating index "confuse" the planner even after a VACUUM ANALYZE? I seem to notice this trend everytime I add a new index to the table. It would slow down and the performance would gradually improve in a day or two. Should I try changing "cost" variables? I'm using Pentium IV, with SCSI [RAID 5]. regards, ludwig. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From pgsql-performance-owner@postgresql.org Wed Oct 23 03:47:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 181DA475D70 for ; Wed, 23 Oct 2002 03:47:07 -0400 (EDT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id B8EBA476020 for ; Wed, 23 Oct 2002 03:47:05 -0400 (EDT) Received: from klaster.net (pr150.krakow.cvx.ppp.tpnet.pl [213.76.42.150]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id D6BE62B2B9 for ; Wed, 23 Oct 2002 09:40:33 +0200 (CEST) Message-ID: <3DB65566.6060906@klaster.net> Date: Wed, 23 Oct 2002 09:53:10 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.1) Gecko/20020826 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: joining views Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/112 X-Sequence-Number: 129 Hi I'd like to split queries into views, but I can't join them - planner search all of records instead of using index. It works very slow. Here is example: 1) create table1( id1 integer primary key, ...fields... ); table1 has thousands rows >40000. 2) create index ind_pkey on table1(id1); 3) create view some_view as select id1,...fields... from table1 join ...(10 joins); 4) create view another_view as select id1,...fields... from table1 join ... (5 joins) 4) Now here is the problem: explain select * from some_view where id1=1234; result: 100 explain select * from another_view where id1=1234; result: 80 explain select * from some_view v1, another_view v2 where v1.id1=1234 and v2.id1=1234 result: 210 Execution plan looks like planner finds 1 record from v1, so cost of searching v1 is about 100. After this planner finds 1 record from v2 (cost 80) and it's like I want to have. explain select * from some_view v1 join another_view v2 using(id1) where v1.id1=1234; result: 10000 (!) explain select * from some_view v1 join some_view v2 using(id1) where v1.id1=1234; result: 10000 (!) Even joining the same view doesn't work well. Execution plan looks like planner finds 1 record from v1, so cost of searching v1 is about 100. After this planner search all of records from v2 (40000 records, cost 9000) and then performs join with v1. I know that I can make only single view without joining views, but it makes me a big mess. Regards, Tomasz Myrta From pgsql-performance-owner@postgresql.org Wed Oct 23 10:31:21 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 07F8D476936 for ; Wed, 23 Oct 2002 10:31:18 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 0CDA647692F for ; Wed, 23 Oct 2002 10:31:17 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9NEVJhR000983; Wed, 23 Oct 2002 10:31:19 -0400 (EDT) To: Tomasz Myrta Cc: pgsql-performance@postgresql.org Subject: Re: joining views In-reply-to: <3DB65566.6060906@klaster.net> References: <3DB65566.6060906@klaster.net> Comments: In-reply-to Tomasz Myrta message dated "Wed, 23 Oct 2002 09:53:10 +0200" Date: Wed, 23 Oct 2002 10:31:18 -0400 Message-ID: <982.1035383478@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/113 X-Sequence-Number: 130 Tomasz Myrta writes: > I'd like to split queries into views, but I can't join them - planner > search all of records instead of using index. It works very slow. I think this is the same issue that Stephan identified in his response to your other posting ("sub-select with aggregate"). When you write FROM x join y using (col) WHERE x.col = const the WHERE-restriction is only applied to x. I'm afraid you'll need to write FROM x join y using (col) WHERE x.col = const AND y.col = const Ideally you should be able to write just FROM x join y using (col) WHERE col = const but I think that will be taken the same as "x.col = const" :-( regards, tom lane From pgsql-performance-owner@postgresql.org Wed Oct 23 10:56:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AD85D476346 for ; Wed, 23 Oct 2002 10:56:26 -0400 (EDT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 0287447623F for ; Wed, 23 Oct 2002 10:56:26 -0400 (EDT) Received: from klaster.net (pr150.krakow.cvx.ppp.tpnet.pl [213.76.42.150]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 926F42B2B9; Wed, 23 Oct 2002 16:49:55 +0200 (CEST) Message-ID: <3DB6BA0A.4060502@klaster.net> Date: Wed, 23 Oct 2002 17:02:34 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.1) Gecko/20020826 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: joining views References: <3DB65566.6060906@klaster.net> <982.1035383478@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/114 X-Sequence-Number: 131 U�ytkownik Tom Lane napisa�: > I think this is the same issue that Stephan identified in his response > to your other posting ("sub-select with aggregate"). When you write > FROM x join y using (col) WHERE x.col = const > the WHERE-restriction is only applied to x. I'm afraid you'll need > to write > FROM x join y using (col) WHERE x.col = const AND y.col = const > Ideally you should be able to write just > FROM x join y using (col) WHERE col = const > but I think that will be taken the same as "x.col = const" :-( I am sad, but you are right. Using views this way will look strange: create view v3 as select v1.id as id1, v2.id as id2, ... from some_view v1, another_view v2; select * from v3 where id1=1234 and id2=1234; Is it possible to make it look better? And how to pass param=const to subquery ("sub-select with aggregate") if I want to create view with this query? Tomasz Myrta From pgsql-performance-owner@postgresql.org Sat Oct 26 06:27:52 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 25C494758BD for ; Sat, 26 Oct 2002 06:27:49 -0400 (EDT) Received: from technovell.com (213-97-10-232.uc.nombres.ttd.es [213.97.10.232]) by postgresql.org (Postfix) with ESMTP id C7295475843 for ; Sat, 26 Oct 2002 06:27:47 -0400 (EDT) Received: from pgsql [192.168.1.200] by technovell.com with NIMS ModWeb Module; Sat, 26 Oct 2002 12:27:28 +0200 Subject: Basic question about indexes/explain From: Terry Yapt To: pgsql-performance@postgresql.org Date: Sat, 26 Oct 2002 12:27:28 +0200 X-Mailer: NIMS ModWeb Module X-Sender: pgsql MIME-Version: 1.0 Message-ID: <1035628048.81bd0c0pgsql@technovell.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/115 X-Sequence-Number: 132 Hi all, I have a basic doubt about indexes... in the next example: -- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D DROP TABLE ctest; CREATE TABLE ctest ( cusid numeric(5) PRIMARY KEY NOT NULL, -- Customer ID. namec varchar(10) NOT NULL, -- Customer Name. surnc varchar(20), -- Customer Surname. cashc numeric(10,4) -- Customer Cash. ); CREATE INDEX ctest_cashc ON ctest (cashc); INSERT INTO ctest VALUES (10,'Ten Custom','S.Ten Customer',1000); INSERT INTO ctest VALUES (5 ,'Five Custo','S.Five Customer',500); INSERT INTO ctest VALUES (8, 'Eigth Cust','S.Eigth Customer',800); INSERT INTO ctest VALUES (90,'Nine Custo','S.Nine Customer',9000); INSERT INTO ctest VALUES (70,'Seven Cust','S.Seven Customer',7000); -- Next two SELECT will execute using index Scan on ctest_pkey explain SELECT * from ctest WHERE cusid between 5 AND 10 AND cashc < 1000; explain SELECT * from ctest WHERE cusid =3D5 AND cashc =3D 1000; CREATE INDEX ctest_othec ON ctest (cusid, cashc); -- Next two SELECT will execute using Seq Scan. explain SELECT * from ctest WHERE cusid between 5 AND 10 AND cashc < 1000; explain SELECT * from ctest WHERE cusid =3D5 AND cashc =3D 1000; -- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D SELECTs executed before CREATE INDEX ctest_othec... are using index scan on= PRIMARY KEY, but after the CREATE INDEX all SELECTs are using seq scan. Seq Scan has lower cost than index scan (I think because there are few rows= in table). But if we have an index with the two colums I am using in the WHERE clause,= why is the planner using seq scan ? (Or perhaps it is because too few row= s in the table ?).... Thanks.. From pgsql-performance-owner@postgresql.org Sat Oct 26 07:40:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1F9F1475843 for ; Sat, 26 Oct 2002 07:40:09 -0400 (EDT) Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id 791C94753A1 for ; Sat, 26 Oct 2002 07:40:06 -0400 (EDT) Received: from loki ([10.192.17.128]) by relay.icomedias.com (8.12.5/8.12.5) with ESMTP id g9QBdq33021779; Sat, 26 Oct 2002 13:39:57 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Mario Weilguni To: Terry Yapt , pgsql-performance@postgresql.org Subject: Re: Basic question about indexes/explain Date: Sat, 26 Oct 2002 13:40:06 +0200 User-Agent: KMail/1.4.3 References: <1035628048.81bd0c0pgsql@technovell.com> In-Reply-To: <1035628048.81bd0c0pgsql@technovell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210261340.06876.mweilguni@sime.com> avpresult: 0, ok, ok X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/116 X-Sequence-Number: 133 Am Samstag, 26. Oktober 2002 12:27 schrieb Terry Yapt: > Hi all, > snip > I have a basic doubt about indexes... in the next example: > But if we have an index with the two colums I am using in the WHERE claus= e, > why is the planner using seq scan ? (Or perhaps it is because too few ro= ws > in the table ?).... First of all, you did not analyze your table (at least you did not mention = you did). And an index is never a win for such a small table. I think the p= lanner is fine here to select a seq scan, because your whole table is only = 1 database page, so it would be no win to check the index here. Everything is explained in the manual, check http://developer.postgresql.or= g/docs/postgres/indexes.html regards, mario weilguni From pgsql-performance-owner@postgresql.org Sat Oct 26 10:24:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 08A38475FEB for ; Sat, 26 Oct 2002 10:24:55 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 67276475EB2 for ; Sat, 26 Oct 2002 10:24:54 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9QEOqhR027302; Sat, 26 Oct 2002 10:24:53 -0400 (EDT) To: Mario Weilguni Cc: Terry Yapt , pgsql-performance@postgresql.org Subject: Re: Basic question about indexes/explain In-reply-to: <200210261340.06876.mweilguni@sime.com> References: <1035628048.81bd0c0pgsql@technovell.com> <200210261340.06876.mweilguni@sime.com> Comments: In-reply-to Mario Weilguni message dated "Sat, 26 Oct 2002 13:40:06 +0200" Date: Sat, 26 Oct 2002 10:24:52 -0400 Message-ID: <27301.1035642292@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/117 X-Sequence-Number: 134 Mario Weilguni writes: > Everything is explained in the manual, check > http://developer.postgresql.org/docs/postgres/indexes.html In particular note the comments at the bottom of http://developer.postgresql.org/docs/postgres/performance-tips.html: "It is worth noting that EXPLAIN results should not be extrapolated to situations other than the one you are actually testing; for example, results on a toy-sized table can't be assumed to apply to large tables. The planner's cost estimates are not linear and so it may well choose a different plan for a larger or smaller table. An extreme example is that on a table that only occupies one disk page, you'll nearly always get a sequential scan plan whether indexes are available or not. The planner realizes that it's going to take one disk page read to process the table in any case, so there's no value in expending additional page reads to look at an index." regards, tom lane From pgsql-performance-owner@postgresql.org Sat Oct 26 18:35:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 83119475C85 for ; Sat, 26 Oct 2002 18:35:25 -0400 (EDT) Received: from VL-MS-MR004.sc1.videotron.ca (relais.videotron.ca [24.201.245.36]) by postgresql.org (Postfix) with ESMTP id 15CB1475BEC for ; Sat, 26 Oct 2002 18:35:25 -0400 (EDT) Received: from mochima.com ([24.202.175.133]) by VL-MS-MR004.sc1.videotron.ca (iPlanet Messaging Server 5.2 HotFix 0.9 (built Jul 29 2002)) with ESMTP id <0H4M009DT1GHJS@VL-MS-MR004.sc1.videotron.ca> for pgsql-performance@postgresql.org; Sat, 26 Oct 2002 18:36:17 -0400 (EDT) Date: Sat, 26 Oct 2002 18:36:05 -0400 From: Carlos Moreno Subject: Setting shared buffers To: pgsql-performance@postgresql.org Message-id: <3DBB18D5.9070000@mochima.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/118 X-Sequence-Number: 135 After checking some docs on performance tuning, I'm trying to follow Bruce Momjian (sp??) advice to set the shared_buffers at 25% of the amount of physical memory (1GB in our server) and 4% for the sort_mem. When I try that, I get an error message when starting postgres, complaining that the amount of shared memory requested exceeds the maximum allowed by the kernel (they talk about increasing the kernel parameter SHMMAX -- does this mean that I have to recompile the kernel? Or is it just a "runtime" configuration parameter that I set and on the next reboot will be taken?) To double check if I understood correctly: I have 1GB, so I want 256MB as shared buffers memory; each shared buffer is 8kbytes, so I take 256M / 8k, which is 32k -- so, I uncomment the line shared_buffers in the configuration file, and put: shared_buffers = 32000 I don't touch anything else (max_connections keeps its default value, but as I understand, that has nothing to do anyway... right?) So, what should I do? Apologies if this is an FAQ -- I tried searching the archives, but I get a 404 - Not Found error when following the link to the archives for this list :-( Thanks in advance for any comments / advice ! Carlos -- From pgsql-performance-owner@postgresql.org Sat Oct 26 20:12:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D2777475BEC for ; Sat, 26 Oct 2002 20:12:51 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 40039475461 for ; Sat, 26 Oct 2002 20:12:51 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1800543; Sat, 26 Oct 2002 17:14:35 -0700 From: "Josh Berkus" Subject: Re: Setting shared buffers To: Carlos Moreno , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Sat, 26 Oct 2002 17:14:35 -0700 Message-ID: In-Reply-To: <3DBB18D5.9070000@mochima.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/119 X-Sequence-Number: 136 Carlos, > After checking some docs on performance tuning, I'm trying to > follow Bruce Momjian (sp??) advice to set the shared_buffers > at 25% of the amount of physical memory (1GB in our server) > and 4% for the sort_mem. I tend to set my shared_buffers somewhat higher, but that's a good place to start. Be cautious about sort_mem on a server with a lot of users; sort_mem is not shared, so make sure that you have enough that your server could handle 1-2 sorts per concurrent user without running out of RAM. > When I try that, I get an error message when starting postgres, > complaining that the amount of shared memory requested exceeds > the maximum allowed by the kernel (they talk about increasing > the kernel parameter SHMMAX -- does this mean that I have to > recompile the kernel? Or is it just a "runtime" configuration > parameter that I set and on the next reboot will be taken?) It's easy, on Linux don't even have to reboot. Other OS's are harder. See this very helpful page: http://www.us.postgresql.org/users-lounge/docs/7.2/postgres/kernel-resources.html#SYSVIPC In fact, I tend to up my SHMMAX and SHMMALL and shared_buffers at night on some databases, when they are doing automatic updates, and adjust them back down during the day, when I want to prevent heavy user loads from using up all system RAM. > I have 1GB, so I want 256MB as shared buffers memory; each > shared buffer is 8kbytes, so I take 256M / 8k, which is 32k -- > so, I uncomment the line shared_buffers in the configuration > file, and put: See the calculations on the page link above. They are more specific than that, and I have found the numbers there to be good estimates, maybe only 10-20% high. -Josh Berkus From pgsql-general-owner@postgresql.org Mon Oct 28 08:25:37 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F0304475956 for ; Mon, 28 Oct 2002 06:01:20 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 90BA74758E1 for ; Mon, 28 Oct 2002 06:01:20 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 32163381A35; Mon, 28 Oct 2002 06:01:18 -0500 (EST) From: "Lars Maschke" X-Newsgroups: comp.databases.postgresql.general, comp.databases.postgresql.performance Subject: [pgsql-performance] Performance Problems Date: Mon, 28 Oct 2002 12:00:52 +0100 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 23 Message-ID: <90iv8-n4s.ln1@server.csg.de> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-performance@postgresql.org, pgsql-general@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/1186 X-Sequence-Number: 32184 Hello Newsgroup I have trouble with postgres 7.2.3. This system works fine, but last week every postmaster process exhausted my system to 100%. What can i do ? When I dump all databases it has 16MB. I start my system with the following command: postmaster -i -c shared_buffers=1024 -c sort_mem=16384 -c effective_cache_size=2048 -c max_connections=128 -c fsync=false -c enable-seqscan=false -c enable_indexscan=false -c enable_tidscan=false -c enable_sort=false -c enable_nestloop=false -c enable_hashjoin=false -c enable-mergejoin=false -c show_parser_stats=false -c show_planner_stats=false -c show_executor_stats=false -c show_query_stats=false -c random_page_cost=0.99 -o -F Can someone help me ? -- Lars Maschke --- Es gibt Tage, da verliert man und es gibt Tage, da gewinnen die anderen. From pgsql-performance-owner@postgresql.org Mon Oct 28 15:47:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 21FC5475FC6 for ; Mon, 28 Oct 2002 15:47:54 -0500 (EST) Received: from web13901.mail.yahoo.com (web13901.mail.yahoo.com [216.136.175.27]) by postgresql.org (Postfix) with SMTP id 60A384758E1 for ; Mon, 28 Oct 2002 15:47:53 -0500 (EST) Message-ID: <20021028204752.45338.qmail@web13901.mail.yahoo.com> Received: from [66.241.89.7] by web13901.mail.yahoo.com via HTTP; Mon, 28 Oct 2002 12:47:52 PST Date: Mon, 28 Oct 2002 12:47:52 -0800 (PST) From: James Kelty Subject: Clusters To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/120 X-Sequence-Number: 137 Hello, I have a question regarding clusters. What with all the hoop-la about Oracle RAC, the question of clustering PostgreSQL has come up at work. Now, I know that only one system can actually update the database, and in a active/passive failover situation that is ok. But! If I have lots and lots of READS from the DB, can I cluster many low end systems together behind an SLB? Assume that all systems have a qlogic card, and are attached to a SAN, and that the SAN holds the data. Can PostgreSQL be configured to read from the SAN? Does each system have to initialize the DB? I think this could greatly improve the perfomance from a application appearance, but, so far I have only seen documentation about Oracle RAC, DB2, and MySQL using some sort of cluster software, be it, kimberlite, Red Hat Cluster Manager, or Vertias Cluster Server. PostgreSQL seems to be our DB of choice, and I just want to have a scalable solution via clustering for it. No replication. Thanks for any thoughts! -James ===== James Kelty 11742 NW Valley Vista Rd. Hillsboro, OR 97124 Cell: 541.621.5832 j_kelty@yahoo.com __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ From pgsql-performance-owner@postgresql.org Mon Oct 28 15:59:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9CE3E47657C for ; Mon, 28 Oct 2002 15:59:26 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 1F209476570 for ; Mon, 28 Oct 2002 15:59:26 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 186Gyt-0008FW-00 for ; Mon, 28 Oct 2002 15:59:27 -0500 Date: Mon, 28 Oct 2002 15:59:27 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Clusters Message-ID: <20021028155927.H21128@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20021028204752.45338.qmail@web13901.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20021028204752.45338.qmail@web13901.mail.yahoo.com>; from j_kelty@yahoo.com on Mon, Oct 28, 2002 at 12:47:52PM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/121 X-Sequence-Number: 138 On Mon, Oct 28, 2002 at 12:47:52PM -0800, James Kelty wrote: > together behind an SLB? Assume that all systems have a > qlogic card, and are attached to a SAN, and that the > SAN holds the data. Can PostgreSQL be configured to > read from the SAN? Does each system have to initialize > the DB? You can't do this safely. PostgreSQL wants to control its disk. Someone has said on the (?) -general list that he has modified the PostgreSQL code to do this, but it makes me nervous. The Postgres-R project is trying to do something similar, but it's some way from production quality. > it. No replication. Thanks for any thoughts! I sort of wonder why "no replication" is a requirement. If you want lots of cheap, read-only machines, why not do it with replication? You can buy a _lot_ of x86 boxes with Promise IDE RAID and big, fast IDE drives for the price of ORAC. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Oct 28 16:18:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E8E51476061 for ; Mon, 28 Oct 2002 16:18:46 -0500 (EST) Received: from mailhost.nxad.com (lan.ext.nxad.com [66.250.180.254]) by postgresql.org (Postfix) with ESMTP id C6FF3475FFF for ; Mon, 28 Oct 2002 16:18:45 -0500 (EST) Received: from perrin.int.nxad.com (perrin.int.nxad.com [192.168.1.251]) by mailhost.nxad.com (Postfix) with ESMTP id 1D48D212EEB; Mon, 28 Oct 2002 13:18:47 -0800 (PST) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id CCFDA20F02; Mon, 28 Oct 2002 13:18:46 -0800 (PST) Date: Mon, 28 Oct 2002 13:18:46 -0800 From: Sean Chittenden To: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: Clusters Message-ID: <20021028211846.GM92719@perrin.int.nxad.com> References: <20021028204752.45338.qmail@web13901.mail.yahoo.com> <20021028155927.H21128@mail.libertyrms.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021028155927.H21128@mail.libertyrms.com> User-Agent: Mutt/1.4i X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 6CEB 1B06 BFD3 70F6 95BE 7E4D 8E85 2E0A 5F5B 3ECB X-Web-Homepage: http://sean.chittenden.org/ X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/122 X-Sequence-Number: 139 > > together behind an SLB? Assume that all systems have a qlogic > > card, and are attached to a SAN, and that the SAN holds the > > data. Can PostgreSQL be configured to read from the SAN? Does each > > system have to initialize the DB? > > You can't do this safely. PostgreSQL wants to control its disk. > Someone has said on the (?) -general list that he has modified the > PostgreSQL code to do this, but it makes me nervous. Didn't Tom say that it was possible if you had different WAL logs for each instance? ie, just share the data directory, but everything else has to be on a per instance basis. Check the archives, someone just asked about this a week ago or so. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Mon Oct 28 16:32:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1D5964762CD for ; Mon, 28 Oct 2002 16:32:15 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 7DFA04761D3 for ; Mon, 28 Oct 2002 16:32:14 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 186HUe-0008Uk-00 for ; Mon, 28 Oct 2002 16:32:16 -0500 Date: Mon, 28 Oct 2002 16:32:16 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Clusters Message-ID: <20021028163216.I21128@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20021028204752.45338.qmail@web13901.mail.yahoo.com> <20021028155927.H21128@mail.libertyrms.com> <20021028211846.GM92719@perrin.int.nxad.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20021028211846.GM92719@perrin.int.nxad.com>; from sean@chittenden.org on Mon, Oct 28, 2002 at 01:18:46PM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/123 X-Sequence-Number: 140 On Mon, Oct 28, 2002 at 01:18:46PM -0800, Sean Chittenden wrote: > > Didn't Tom say that it was possible if you had different WAL logs for > each instance? ie, just share the data directory, but everything else > has to be on a per instance basis. Check the archives, someone just > asked about this a week ago or so. -sc As Sean says, check the archives. But I think the problem is bigger than just the WAL. For instance, the pidfile is in the data directory, so each system is going to try to overwrite that. Plus, there's no read-only mode for Postgres, so if one of the systems writes where it shouldn't, you'll blow everything away. I can appreciate that some people like to play at the bare metal this way, but it gives me ulcers ;-) A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Oct 28 16:56:19 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2E520475F37 for ; Mon, 28 Oct 2002 16:56:18 -0500 (EST) Received: from l2.socialecology.com (unknown [4.42.179.131]) by postgresql.org (Postfix) with ESMTP id 87AFD475D99 for ; Mon, 28 Oct 2002 16:56:17 -0500 (EST) Received: from 4.42.179.151 (broccoli.socialecology.com [4.42.179.151]) by l2.socialecology.com (Postfix) with SMTP id 3B38F201EF8 for ; Mon, 28 Oct 2002 13:56:18 -0800 (PST) X-Mailer: UserLand Frontier 8.0.5 (Macintosh OS) (mailServer v1.1..142) Mime-Version: 1.0 Message-Id: <74264850.1176309122@[4.42.179.151]> X-authenticated-sender: erics X-GSgroup: private Date: Mon, 28 Oct 2002 13:56:14 -0800 To: pgsql-performance@postgresql.org From: eric soroos Subject: Low Budget Performance Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/124 X-Sequence-Number: 141 I'm looking for some advice or benchmarks comparing low end systems for a postgres installation. Currently, I've got postgres running on the same system as the app server accessing a single fast IDE drive. The database is on the order of 1 gig, with two main tables accounting for 98% of the data. Between the app servers and the database, I'm pretty sure that neither of the main tables are cached in memory for any significant time. I'm guessing that this is sub optimal. (The data size is 1 gig now, but I will be adding more 1 gig databases to this system in the near future) I'm planning to split this into an app server and database server. In an ideal world, I'd throw a lot of 15k scsi/raid0+1 at this. But I don't have an ideal world budget. I've got more of an ide world budget, if that. (~1k) I know the first order of business is to ignore the hardware and make sure that I've got all of the table scans found and turned into indexes. I'm still working on that. Are there any tools that save queries and the plans, then report on the ones that are the biggest performance drags? But since I do software, it's obviously a hardware problem. ;> My hardware options: Processor: * My low cost option is to repurpose an under used p3 with onboard IDE raid and pc133 memory. The high cost option is to get a new mid range Athalon with 266/ddr memory. Will maxing out the memory mean that whatever I don't use for client connections will be used for caching the drive system? (most likely, I will be running debian woody with a 2.4 series kernel) Drives: * The cost difference between IDE and SCSI is roughly a factor of 2-4x. (100 gig 7200 rpm IDE can be had for a little over $100, 10k 36 gig SCSI is about $200. Am I better off throwing twice as many (4) IDE disks at the system? Does it change if I can put each IDE drive on its own channel? Drive Layout: * What Drive layout? Raid? 0 gives better latency if the controller reads from whichever gets the data first. It's unclear if IDE or software raid actually does this though. 1 Gives better throughput, at a cost to latency. 5 Like 1 but with redundancy. It's unclear if I'll be able to do this without hardware SCSI raid. Non Raid? I've read about seperating table spaces on different drives, so that indexes and data can be written at the same time. This advice appears to be tailored to the complexity of oracle. The ideal configuration according to this info appears to be multiple drives, all mirrored individually. Does the write ahead logging of PG mean that no matter what indexes and data are changed, that there will be one sync to disk? Does this reduce the penalty of indexes? WAL seems to mean that to get performance out of a drive array, I'd want to use the fastest (latency/throughput) logical single image I could get, not a collection of mirrored drives. I'd appreciate any insight. eric From pgsql-performance-owner@postgresql.org Mon Oct 28 17:07:13 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9B4A0475B8E for ; Mon, 28 Oct 2002 17:07:11 -0500 (EST) Received: from VL-MS-MR001.sc1.videotron.ca (relais.videotron.ca [24.201.245.36]) by postgresql.org (Postfix) with ESMTP id 8DC4F47668E for ; Mon, 28 Oct 2002 17:07:05 -0500 (EST) Received: from mochima.com ([24.202.175.133]) by VL-MS-MR001.sc1.videotron.ca (iPlanet Messaging Server 5.2 HotFix 0.9 (built Jul 29 2002)) with ESMTP id <0H4P00HIKPG4M4@VL-MS-MR001.sc1.videotron.ca> for pgsql-performance@postgresql.org; Mon, 28 Oct 2002 17:07:17 -0500 (EST) Date: Mon, 28 Oct 2002 17:07:42 -0500 From: Carlos Moreno Subject: Re: Setting shared buffers To: pgsql-performance@postgresql.org Message-id: <3DBDB52E.500@mochima.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 References: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/125 X-Sequence-Number: 142 Thanks John! This is very helpful... Just one detail I'd like to double check: >It's easy, on Linux don't even have to reboot. Other OS's are harder. > See this very helpful page: >http://www.us.postgresql.org/users-lounge/docs/7.2/postgres/kernel-resources.html#SYSVIPC > >In fact, I tend to up my SHMMAX and SHMMALL and shared_buffers [...] > According to that document, I should put the same value for the SHMMAX and SHMMALL -- however, when I do: cat /proc/sys/kernel/shmmax cat /proc/sys/kernel/shmmall on my Linux system (RedHat 7.3, soon to upgrade to 8.0), I get different values, shmmall being shmmax divided by 16 Is that normal? What should I do? Should I follow the exact same instructions from that document and set both to the exact same value? Are the default values set that way (i.e., different values) for some strange reason, or is it that on the 2.4 kernel the shmmall is indicated in blocks of 16 bytes or something like that? Thanks! Carlos -- From pgsql-performance-owner@postgresql.org Mon Oct 28 19:00:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9BF5C475D64 for ; Mon, 28 Oct 2002 19:00:36 -0500 (EST) Received: from web13907.mail.yahoo.com (web13907.mail.yahoo.com [216.136.175.70]) by postgresql.org (Postfix) with SMTP id 0BB4D47590C for ; Mon, 28 Oct 2002 19:00:36 -0500 (EST) Message-ID: <20021029000038.72409.qmail@web13907.mail.yahoo.com> Received: from [66.241.89.7] by web13907.mail.yahoo.com via HTTP; Mon, 28 Oct 2002 16:00:38 PST Date: Mon, 28 Oct 2002 16:00:38 -0800 (PST) From: James Kelty Subject: Re: Clusters To: Andrew Sullivan , pgsql-performance@postgresql.org In-Reply-To: <20021028155927.H21128@mail.libertyrms.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/126 X-Sequence-Number: 143 I've just been very unhappy with the ease of use for Postgres replication. Pgreplicator was a huge pain that worked less often than not, rserv was really unmanageable. I haven't had a chance to look at dbmirror yet, though. Plus the replication would start to chew up network bandwidth at some point. Of course, so would reading from the SAN. But, then there is the issue of system failure. If the system has to be re-imaged, then I'd have to take a snap shot of the master, and re-apply it to the new system. It just seems more manageable if I can plug in a new Postgres 'instance' to the SAN, and have it up to date the minute it starts. I know that postgres doesn't have a 'read-only' mode, but it does have the GRANT option. So, access to the DB _can_ be controlled that way at least. Anyway, thanks for all the thoughts and info. If anyone knows of some other replication service besides the two listed above, great! Let me know! Lemme just say, that the feature set of Postgres, when talking strictly database, is AWESOME. Really easy to work with, and around, but, in the HA world, it seems a little difficult to work with. Thanks again, Guys! -James --- Andrew Sullivan wrote: > On Mon, Oct 28, 2002 at 12:47:52PM -0800, James > Kelty wrote: > > together behind an SLB? Assume that all systems > have a > > qlogic card, and are attached to a SAN, and that > the > > SAN holds the data. Can PostgreSQL be configured > to > > read from the SAN? Does each system have to > initialize > > the DB? > > You can't do this safely. PostgreSQL wants to > control its disk. > Someone has said on the (?) -general list that he > has modified the > PostgreSQL code to do this, but it makes me nervous. > > The Postgres-R project is trying to do something > similar, but it's > some way from production quality. > > > it. No replication. Thanks for any thoughts! > > I sort of wonder why "no replication" is a > requirement. If you want > lots of cheap, read-only machines, why not do it > with replication? > You can buy a _lot_ of x86 boxes with Promise IDE > RAID and big, fast > IDE drives for the price of ORAC. > > A > > -- > ---- > Andrew Sullivan 204-4141 > Yonge Street > Liberty RMS Toronto, > Ontario Canada > > M2P 2A8 > +1 416 646 > 3304 x110 > > > ---------------------------(end of > broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org ===== James Kelty 11742 NW Valley Vista Rd. Hillsboro, OR 97124 Cell: 541.621.5832 j_kelty@yahoo.com __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ From pgsql-performance-owner@postgresql.org Mon Oct 28 22:27:33 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3945647681C for ; Mon, 28 Oct 2002 22:27:32 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 7B03C476819 for ; Mon, 28 Oct 2002 22:27:31 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 186N2W-0004kV-00 for ; Mon, 28 Oct 2002 22:27:36 -0500 Date: Mon, 28 Oct 2002 22:27:36 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Clusters Message-ID: <20021028222736.A18141@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20021028155927.H21128@mail.libertyrms.com> <20021029000038.72409.qmail@web13907.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20021029000038.72409.qmail@web13907.mail.yahoo.com>; from j_kelty@yahoo.com on Mon, Oct 28, 2002 at 04:00:38PM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/127 X-Sequence-Number: 144 On Mon, Oct 28, 2002 at 04:00:38PM -0800, James Kelty wrote: > that worked less often than not, rserv was really > unmanageable. We use PostgreSQL, Inc's eRserver, which is a commercial version of the code in contrib/, and I can say that it is not unmanageable, but it is some work at first. The commercial version is an improvement on the contrib/ code, though. For us, it's worth it; but you have to decide that for yourself. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Oct 29 01:30:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 72E59475FB7 for ; Tue, 29 Oct 2002 01:30:19 -0500 (EST) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id E276C475EE2 for ; Tue, 29 Oct 2002 01:30:17 -0500 (EST) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g9T6UHf15829 for ; Tue, 29 Oct 2002 12:00:17 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g9T6UHv15824 for ; Tue, 29 Oct 2002 12:00:17 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Tue, 29 Oct 2002 12:00:45 +0530 MIME-Version: 1.0 Subject: Re: Low Budget Performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DBE786D.1218.396F01B@localhost> In-reply-to: <74264850.1176309122@[4.42.179.151]> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/128 X-Sequence-Number: 145 On 28 Oct 2002 at 13:56, eric soroos wrote: > Currently, I've got postgres running on the same system as the app server accessing a single fast IDE drive. The database is on the order of 1 gig, with two main tables accounting for 98% of the data. Between the app servers and the database, I'm pretty sure that neither of the main tables are cached in memory for any significant time. I'm guessing that this is sub optimal. (The data size is 1 gig now, but I will be adding more 1 gig databases to this system in the near future) I'm planning to split this into an app server and database server. > > In an ideal world, I'd throw a lot of 15k scsi/raid0+1 at this. But I don't have an ideal world budget. I've got more of an ide world budget, if that. (~1k) > > I know the first order of business is to ignore the hardware and make sure that I've got all of the table scans found and turned into indexes. I'm still working on that. Are there any tools that save queries and the plans, then report on the ones that are the biggest performance drags? > > But since I do software, it's obviously a hardware problem. ;> > > My hardware options: I would say throw a lot of RAM no matter what type. Even PC133 is going to be faster than any disk you can buy anytimes. I would say 2Gig is a nice place to start. A gig is not much of a database but a lot depends upon what do you do with the data. Obviously 50 clients doing sequential scan with rows ordered in random fashion would chew any box,..;-) Processor does not matter much. But I would advice to split app server and database server ASAP. Well, IDE RAID looks like nice optio to me, but before finalising RAID config., I would advice to test performance and scalability with separate database server and couple of Gigs of RAM. Because if this configuration is sufficient for your need, probably you can choose a conservatice RAID config that would enhance availability rather than getting every ounce of performance out of it. As far as possible, don't compramise with storage availability. > Does the write ahead logging of PG mean that no matter what indexes and data are changed, that there will be one sync to disk? Does this reduce the penalty of indexes? WAL seems to mean that to get performance out of a drive array, I'd want to use the fastest (latency/throughput) logical single image I could get, not a collection of mirrored drives. I guess RAID will take care of lot of these issues. Besides if you use volume manager you can add partitions from different disks, effectively splitting the IO. Of course, you can shutdown the database and symlink things to another drive, but that's hack and nothing else. Don't do it as far as possible.. HTH Bye Shridhar -- You're dead, Jim. -- McCoy, "Amok Time", stardate 3372.7 From pgsql-performance-owner@postgresql.org Tue Oct 29 01:41:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D854C475B85 for ; Tue, 29 Oct 2002 01:41:34 -0500 (EST) Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) by postgresql.org (Postfix) with ESMTP id CFD34475458 for ; Tue, 29 Oct 2002 01:41:33 -0500 (EST) Received: from loki ([10.192.17.128]) by relay.icomedias.com (8.12.5/8.12.5) with ESMTP id g9T6fU33032225; Tue, 29 Oct 2002 07:41:31 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Mario Weilguni To: eric soroos , pgsql-performance@postgresql.org Subject: Re: Low Budget Performance Date: Tue, 29 Oct 2002 08:07:50 +0100 User-Agent: KMail/1.4.3 References: <74264850.1176309122@[4.42.179.151]> In-Reply-To: <74264850.1176309122@[4.42.179.151]> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210290807.50625.mweilguni@sime.com> avpresult: 0, ok, ok X-Scanned-By: MIMEDefang 2.16 (www . roaringpenguin . com / mimedefang) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/129 X-Sequence-Number: 146 Am Montag, 28. Oktober 2002 22:56 schrieb eric soroos: > Raid? > 0 gives better latency if the controller reads from whichever gets the da= ta > first. It's unclear if IDE or software raid actually does this though. 1 > Gives better throughput, at a cost to latency. > 5 Like 1 but with redundancy. It's unclear if I'll be able to do this > without hardware SCSI raid. Just for the raid part, we've very good expiriences with Raid 10. Performs = well and has mirroring. Avoid Raid 5 if possible, write performance will su= ffer greatly. Regards, Mario Weilguni From pgsql-general-owner@postgresql.org Tue Oct 29 08:38:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 03BFA4765BA; Tue, 29 Oct 2002 08:38:22 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id B08374765B0; Tue, 29 Oct 2002 08:38:20 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 186WZc-000590-00; Tue, 29 Oct 2002 08:38:24 -0500 Date: Tue, 29 Oct 2002 08:38:24 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [pgsql-performance] Performance Problems Message-ID: <20021029083824.C18292@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org, pgsql-general@postgresql.org References: <90iv8-n4s.ln1@server.csg.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <90iv8-n4s.ln1@server.csg.de>; from lars@gmeiner.de on Mon, Oct 28, 2002 at 12:00:52PM +0100 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/1271 X-Sequence-Number: 32269 On Mon, Oct 28, 2002 at 12:00:52PM +0100, Lars Maschke wrote: > Can someone help me ? Maybe. You need to tell us what "exhausted your system" means. Did it crash? Were you swapping? Were your CPUs pegged? A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Oct 29 08:43:41 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 90AED476032 for ; Tue, 29 Oct 2002 08:43:40 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 0550E475FFF for ; Tue, 29 Oct 2002 08:43:40 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9TDhchR021027; Tue, 29 Oct 2002 08:43:38 -0500 (EST) To: Sean Chittenden Cc: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: Clusters In-reply-to: <20021028211846.GM92719@perrin.int.nxad.com> References: <20021028204752.45338.qmail@web13901.mail.yahoo.com> <20021028155927.H21128@mail.libertyrms.com> <20021028211846.GM92719@perrin.int.nxad.com> Comments: In-reply-to Sean Chittenden message dated "Mon, 28 Oct 2002 13:18:46 -0800" Date: Tue, 29 Oct 2002 08:43:38 -0500 Message-ID: <21026.1035899018@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/131 X-Sequence-Number: 148 Sean Chittenden writes: > together behind an SLB? Assume that all systems have a qlogic > card, and are attached to a SAN, and that the SAN holds the > data. Can PostgreSQL be configured to read from the SAN? Does each > system have to initialize the DB? >> >> You can't do this safely. PostgreSQL wants to control its disk. >> Someone has said on the (?) -general list that he has modified the >> PostgreSQL code to do this, but it makes me nervous. > Didn't Tom say that it was possible if you had different WAL logs for > each instance? I said no such thing. I said it will not work, period. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Oct 29 09:26:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B92B2475458 for ; Tue, 29 Oct 2002 09:26:34 -0500 (EST) Received: from batch3.csd.uwm.edu (batch3.csd.uwm.edu [129.89.7.226]) by postgresql.org (Postfix) with ESMTP id 22B86475425 for ; Tue, 29 Oct 2002 09:26:34 -0500 (EST) Received: from alpha3.csd.uwm.edu (daemon@alpha3.csd.uwm.edu [129.89.7.203] (may be forged)) by batch3.csd.uwm.edu (8.12.6/8.12.6) with ESMTP id g9TEQcI5022972 for ; Tue, 29 Oct 2002 08:26:38 -0600 (CST) Received: (from kklatt@localhost) by alpha3.csd.uwm.edu (8.12.6/8.12.6) id g9TEQbJx014363 for pgsql-performance@postgresql.org; Tue, 29 Oct 2002 08:26:37 -0600 (CST) Date: Tue, 29 Oct 2002 08:26:37 -0600 From: Kenny H Klatt To: pgsql-performance@postgresql.org Subject: Possible OT - Benchmark test for 7.3 Beta 3 Message-ID: <20021029142637.GA11684@alpha3.csd.uwm.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/132 X-Sequence-Number: 149 Hi: Not being too versed with postgres and beta tests, is there a place or person who would review the results of the benchmark test for 7.3? kklatt@uwm.edu From pgsql-performance-owner@postgresql.org Tue Oct 29 10:15:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 79618475F22 for ; Tue, 29 Oct 2002 10:15:52 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id D35B8475EEB for ; Tue, 29 Oct 2002 10:15:51 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 186Y60-0006oD-00 for ; Tue, 29 Oct 2002 10:15:56 -0500 Date: Tue, 29 Oct 2002 10:15:56 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Possible OT - Benchmark test for 7.3 Beta 3 Message-ID: <20021029101556.B25851@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20021029142637.GA11684@alpha3.csd.uwm.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20021029142637.GA11684@alpha3.csd.uwm.edu>; from kklatt@alpha3.csd.uwm.edu on Tue, Oct 29, 2002 at 08:26:37AM -0600 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/133 X-Sequence-Number: 150 On Tue, Oct 29, 2002 at 08:26:37AM -0600, Kenny H Klatt wrote: > Hi: > Not being too versed with postgres and beta tests, is there > a place or person who would review the results of the benchmark test for 7.3? I'm unaware of anyone having done a benchmark. If you know of one, please share it with all of us. A ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Oct 29 11:58:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8ED52476083 for ; Tue, 29 Oct 2002 11:58:39 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id CB0EC476487 for ; Tue, 29 Oct 2002 11:58:25 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1803601 for ; Tue, 29 Oct 2002 09:00:27 -0800 From: "Josh Berkus" Subject: Re: Low Budget Performance To: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 29 Oct 2002 09:00:27 -0800 Message-ID: In-Reply-To: <3DBE786D.1218.396F01B@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/134 X-Sequence-Number: 151 Eric, > > Currently, I've got postgres running on the same system as the app > server accessing a single fast IDE drive. The database is on the > order of 1 gig, with two main tables accounting for 98% of the data. > Between the app servers and the database, I'm pretty sure that > neither of the main tables are > cached in memory for any significant time. I'm guessing that this is > sub optimal. (The data size is 1 gig now, but I will be adding more 1 > gig databases to this system in the near future) I'm planning to > split this into an app server and database server. One gig is a large database for a single IDE drive -- especially with multiple client connections. > > In an ideal world, I'd throw a lot of 15k scsi/raid0+1 at this. > But I don't have an ideal world budget. I've got more of an ide > world budget, if that. (~1k) Well, no matter how many performance tricks you add in, the speed will be limited by the hardware. Make sure that your client/employer knows that *before* they complain about the speed. > > I know the first order of business is to ignore the hardware and > make sure that I've got all of the table scans found and turned into > indexes. I'm still working on that. Are there any tools that save > queries and the plans, then report on the ones that are the biggest > performance drags? Not exactly. If you enable Postgres 7.2 STATISTICS, you can get a lot of information about which indexes are being used, which are not, and which tables are having a lot of table scans. A tool like you describe would be really, really useful -- in fact, if anyone wrote one, I'm sure you could sell it for $$$$. > > But since I do software, it's obviously a hardware problem. ;> Actually, your best option for the hardware is to test what portion of the hardware is bottlenecking your performance, and address that. But first: > Well, IDE RAID looks like nice optio to me, but before finalising > RAID config., > I would advice to test performance and scalability with separate > database > server and couple of Gigs of RAM. I'm not convinced that current IDE RAID actually improves database disk throughput -- there's a lot of overhead in the one controller I tried (Promise). Does anyone have some statistics they can throw at me? A cheaper and easier method, involving 3-4 disks: Channel 1, Disk 1: Operating System, Swap, and PostgreSQL log Channel 1, Disk 2: WAL Files Channel 2, Disk 1: Database Channel 2, Disk 2 (optional): 2nd database data *however*, if you have multiple databases being simulteaneously accessesed, you will want to experiment with shuffling around the databases and WAL files to put them on different disks. The principle is to divide the disk tasks that are simultaenous ammonng as many disks as possible; thus the WAL files always do better on a different disk and channel than the database. > > Does the write ahead logging of PG mean that no matter what indexes > and data are changed, that there will be one sync to disk? Does this > reduce the penalty of indexes? In a word: No. Depending on the size of the update, there may be multiple synchs. And indexes do carry a significant penalty on large updates; just try runninng 10,000 updates to an indexed column as one transaction, and the penalty will be obvious. In fact, for my data load procedures, I tend to drop and re-create indexes. > WAL seems to mean that to get > performance out of a drive array, I'd want to use the fastest > (latency/throughput) logical > single image I could get, not a collection of mirrored drives. Mirrored drives are different than RAID. However, you are correct that the redundancy/fail-over factor in some RAID and Mirroring comes at a performance penalty. But you need to determine where you are actually losing time. Assuming that your tables are correctly indexed, your files are distributed, and your database is VACUUM FULL ANALYZed, and your postgresql.conf configured for optimum use of your exisiting memory, then here's what you do (assuming that you use Linux) 1. From a workstation, open 2 terminal windows on the server. In #1, run "vmstat 3", in the other "top" 2. Have your users pound on the application, trying all of the most complicated (and slow) operations in the app. More users is better, for this test. 3. Watch Vmstat and Top. What you're looking for is: a) Is the processor at 75% or above? If so, you either need a faster processor or more efficient queries b) Is the system using 80-100% of the RAM which you allocated it? If so, add more RAM and increase the Postgresql.conf memory variables. c) Is the system using Swap memory? if so, either add more RAM, or *decrease* the postgresql.conf memory variables. d) Are RAM and Processor at less than 50%, but the Disk I/O reaches a maximum number and stays there for minutes? Then your disk channel is flooded, and you cannot improve performance except by either improving your queries so the pull less rows, or adding more/faster disk capacity. The above process, while drawn-out, will help you avoid spending a lot of money on, for example, RAM that won't make a difference. -Josh Berkus From pgsql-performance-owner@postgresql.org Tue Oct 29 12:08:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3AA5F475DBC for ; Tue, 29 Oct 2002 12:08:29 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 82CE0475D70 for ; Tue, 29 Oct 2002 12:08:28 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1803616; Tue, 29 Oct 2002 09:10:31 -0800 From: "Josh Berkus" Subject: Re: Low Budget Performance To: Mario Weilguni , eric soroos , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 29 Oct 2002 09:10:31 -0800 Message-ID: In-Reply-To: <200210290807.50625.mweilguni@sime.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/135 X-Sequence-Number: 152 Mario, > Just for the raid part, we've very good expiriences with Raid 10. > Performs well and has mirroring. Avoid Raid 5 if possible, write > performance will suffer greatly. Out of curiousity, what is it with RAID 5? I've encountered the poor write performance too ... any idea why? -Josh From pgsql-performance-owner@postgresql.org Tue Oct 29 12:31:07 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B8666476161 for ; Tue, 29 Oct 2002 12:31:05 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 1CD12476139 for ; Tue, 29 Oct 2002 12:31:05 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 186aCs-0000RQ-00 for ; Tue, 29 Oct 2002 12:31:10 -0500 Date: Tue, 29 Oct 2002 12:31:10 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Low Budget Performance Message-ID: <20021029123110.M25851@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <200210290807.50625.mweilguni@sime.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from josh@agliodbs.com on Tue, Oct 29, 2002 at 09:10:31AM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/136 X-Sequence-Number: 153 On Tue, Oct 29, 2002 at 09:10:31AM -0800, Josh Berkus wrote: > > Out of curiousity, what is it with RAID 5? I've encountered the poor > write performance too ... any idea why? It largely depends on the controller and te implementation. It has to do with the cost of calculating the checksum. If the implementation of that is inefficient, the writes become inefficient. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Oct 29 13:43:41 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 42A2F475DB4 for ; Tue, 29 Oct 2002 13:43:40 -0500 (EST) Received: from l2.socialecology.com (unknown [4.42.179.131]) by postgresql.org (Postfix) with ESMTP id 8CEEA475CED for ; Tue, 29 Oct 2002 13:43:39 -0500 (EST) Received: from 4.42.179.151 (broccoli.socialecology.com [4.42.179.151]) by l2.socialecology.com (Postfix) with SMTP id 6A2A9204439 for ; Tue, 29 Oct 2002 10:43:38 -0800 (PST) X-Mailer: UserLand Frontier 8.0.5 (Macintosh OS) (mailServer v1.1..142) Mime-Version: 1.0 Message-Id: <78755096.1176234283@[4.42.179.151]> X-authenticated-sender: erics In-reply-to: Date: Tue, 29 Oct 2002 10:43:33 -0800 To: pgsql-performance@postgresql.org From: eric soroos Subject: Re: Low Budget Performance Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/137 X-Sequence-Number: 154 Josh, Thanks for the reply. > One gig is a large database for a single IDE drive -- especially with > multiple client connections. That's good to know. Is a scsi system that much better? Looking at prices, scsi is 1/2 the capacity and double the price for the 80 gig 7200rpm ide vs 36 gig 10k rpm scsi. Assuming that I'll never run out of space before running out of performance, I can dedicate 2x the number of ide drives to the problem. > > Well, IDE RAID looks like nice optio to me, but before finalising > > RAID config., > > I would advice to test performance and scalability with separate > > database > > server and couple of Gigs of RAM. > > I'm not convinced that current IDE RAID actually improves database disk > throughput -- there's a lot of overhead in the one controller I tried > (Promise). Does anyone have some statistics they can throw at me? All of the benchmarks that I've seen show that IDE raid is good for large operations, but for random seek and small data transfers, you don't get anywhere near the expected scaling. > A cheaper and easier method, involving 3-4 disks: > > Channel 1, Disk 1: Operating System, Swap, and PostgreSQL log > Channel 1, Disk 2: WAL Files > Channel 2, Disk 1: Database > Channel 2, Disk 2 (optional): 2nd database data With IDE, I think I can manage to put each drive on a seperate channel. I've either got one extra controller onboard, or I can add a 4 channel pci card. From what I've read, this is one of the more important factors in IDE performance. > *however*, if you have multiple databases being simulteaneously > accessesed, you will want to experiment with shuffling around the > databases and WAL files to put them on different disks. The principle > is to divide the disk tasks that are simultaenous ammonng as many disks > as possible; thus the WAL files always do better on a different disk > and channel than the database. That's what I've read about database disk system design. Reduce spindle contention by using lots of drives. (especially in Philip Greenspun's book, but he's talking about 2x7 drives as a minimal configuration and 2x21 as ideal for larger systems. And when licensing is more expensive than that sort of drive system, it's all roundoff error.) So, assuming that I have three databases with roughly equal load on them, does it make sense to partition them like: disk 0: os/swap/log/backup staging disk 1: WAL 1, DB 2 disk 2: WAL 2, DB 3 disk 3: WAL 3, DB 1 Or, in a slightly bigger drive system split 2 ways then mirrored. disk 0: os etc Disk 1,2: WAL 1, DB 2 Disk 3,4: WAL 2, DB 1 From an admin point of view, would this be done with alternate locations, symlinks, or multiple concurrent pg processes? > > > Does the write ahead logging of PG mean that no matter what indexes > > and data are changed, that there will be one sync to disk? Does this > > reduce the penalty of indexes? > > In a word: No. Depending on the size of the update, there may be > multiple synchs. And indexes do carry a significant penalty on large > updates; just try runninng 10,000 updates to an indexed column as one > transaction, and the penalty will be obvious. In fact, for my data > load procedures, I tend to drop and re-create indexes. Most of my update procedures are single row updates, with the exception being things that are already background tasks that the user doesn't notice the difference between 10 and 20 sec. So maybe I'm lucky there. > Mirrored drives are different than RAID. However, you are correct > that the redundancy/fail-over factor in some RAID and Mirroring comes > at a performance penalty. From howtos I've seen, there _can_ be a speed boost with mirroring on read using the linux kernel raid 1. Write performance suffers though. > But you need to determine where you are actually losing time. That looks like it will get me started. eric From pgsql-performance-owner@postgresql.org Tue Oct 29 15:13:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C1AAE476272 for ; Tue, 29 Oct 2002 15:13:44 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 48DCB4761B2 for ; Tue, 29 Oct 2002 15:13:44 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 186ck9-0001xC-00 for ; Tue, 29 Oct 2002 15:13:41 -0500 Date: Tue, 29 Oct 2002 15:13:41 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Low Budget Performance Message-ID: <20021029151341.S25851@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <78755096.1176234283@[4.42.179.151]> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <78755096.1176234283@[4.42.179.151]>; from eric-psql@soroos.net on Tue, Oct 29, 2002 at 10:43:33AM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/138 X-Sequence-Number: 155 On Tue, Oct 29, 2002 at 10:43:33AM -0800, eric soroos wrote: > Is a scsi system that much better? Looking at prices, scsi is 1/2 > the capacity and double the price for the 80 gig 7200rpm ide vs 36 > gig 10k rpm scsi. Assuming that I'll never run out of space before > running out of performance, I can dedicate 2x the number of ide > drives to the problem. SCSI is dramatically better at using the interface. It is much smarter about, for instance, handling multiple disks at the same time; and it requires less attention from the CPU. That said, if you have enough high speed IDE controllers and disks, you'll probably beat an older SCSI system. And you can't beat the price/performance of IDE RAID. We use it for some applications. Note also that you get better RAID controllers from SCSI vendors, just because it's the official high speed offering. The Promise IDE RAID is nice, but it sure isn't as fast as the latest SCSI RAID controllers. (We have also found that there's some overhead in the IDE RAID. It was better under FreeBSD than I'm now experiencing under Linux. But that might just be my prejudices showing!) A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Oct 29 16:09:50 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 450EB47683F for ; Tue, 29 Oct 2002 16:09:49 -0500 (EST) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by postgresql.org (Postfix) with ESMTP id 7FDB04767AD for ; Tue, 29 Oct 2002 16:09:41 -0500 (EST) Received: from localhost.localdomain ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021029210943.RGZU16428.lakemtao03.cox.net@localhost.localdomain> for ; Tue, 29 Oct 2002 16:09:43 -0500 Subject: Re: Low Budget Performance From: Ron Johnson To: pgsql-performance@postgresql.org In-Reply-To: <20021029123110.M25851@mail.libertyrms.com> References: <200210290807.50625.mweilguni@sime.com> <20021029123110.M25851@mail.libertyrms.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 29 Oct 2002 15:09:41 -0600 Message-Id: <1035925781.11600.42.camel@haggis> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/139 X-Sequence-Number: 156 On Tue, 2002-10-29 at 11:31, Andrew Sullivan wrote: > On Tue, Oct 29, 2002 at 09:10:31AM -0800, Josh Berkus wrote: > > > > Out of curiousity, what is it with RAID 5? I've encountered the poor > > write performance too ... any idea why? > > It largely depends on the controller and te implementation. It has > to do with the cost of calculating the checksum. If the > implementation of that is inefficient, the writes become inefficient. A high-quality smart controller with lots of cache RAM definitely negates the RAID5 performance issues. (Of course, I'm referring to enterprise-level rack-mounted h/w that costs big bucks...) -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Oct 29 16:57:30 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4FEEF475D3B for ; Tue, 29 Oct 2002 16:57:29 -0500 (EST) Received: from mail.taxrefund.com (mail.internalrevenueservice.com [216.88.69.2]) by postgresql.org (Postfix) with ESMTP id C440E475CED for ; Tue, 29 Oct 2002 16:57:28 -0500 (EST) Received: from treesp1 [10.10.2.123] by mail.taxrefund.com (SMTPD32-7.10) id A58F680036; Tue, 29 Oct 2002 16:02:55 -0600 From: "Robert J. Sanford, Jr." To: Subject: Re: Low Budget Performance Date: Tue, 29 Oct 2002 15:57:29 -0600 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <1035925781.11600.42.camel@haggis> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/140 X-Sequence-Number: 157 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] > On Behalf Of Ron Johnson > Sent: Tuesday, October 29, 2002 3:10 PM > To: pgsql-performance@postgresql.org > Subject: Re: [pgsql-performance] Low Budget Performance > > > On Tue, 2002-10-29 at 11:31, Andrew Sullivan wrote: > > On Tue, Oct 29, 2002 at 09:10:31AM -0800, Josh Berkus > > wrote: > > > > > > Out of curiousity, what is it with RAID 5? I've > > > encountered the poor write performance too ... any > > > idea why? > > > > It largely depends on the controller and the > > implementation. It has to do with the cost of > > calculating the checksum. If the implementation of > > that is inefficient, the writes become inefficient. > > A high-quality smart controller with lots of cache RAM > definitely negates the RAID5 performance issues. > > (Of course, I'm referring to enterprise-level rack-mounted > h/w that costs big bucks...) Only if you buy it new. EBay has some great deals these days. My company just purchased a very nice Quad Xeon w/ 2GB RAM and last year's high-end PERC RAID controller for under $5K. The external drive array was a bit more expensive but that is an optional purchase. The 3x9GB SCSI drives that came with the machine should be more than sufficient to run a greater than small database server. If you don't want to spend $5K there are Dual Xeon machines with less RAM and not quite so nice RAID controllers that you can get in the $2.5K to $3.5K range. rjsjr From pgsql-performance-owner@postgresql.org Wed Oct 30 20:38:52 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D4380475A1E for ; Wed, 30 Oct 2002 20:38:50 -0500 (EST) Received: from new-smtp2.ihug.com.au (new-smtp2.ihug.com.au [203.109.250.28]) by postgresql.org (Postfix) with ESMTP id E3236474E5C for ; Wed, 30 Oct 2002 20:38:49 -0500 (EST) Received: from p17-tnt2.mel.ihug.com.au (postgresql.org) [203.173.164.17] by new-smtp2.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 1874II-0006NR-00; Thu, 31 Oct 2002 12:38:47 +1100 Message-ID: <3DC089A4.7B6D3B9E@postgresql.org> Date: Thu, 31 Oct 2002 12:38:45 +1100 From: Justin Clift X-Mailer: Mozilla 4.79 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org Subject: Re: PG_Autotune 0.1 References: <200210151100.58044.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/141 X-Sequence-Number: 158 Josh Berkus wrote: > > Folks, Justin, > > Hey, I've been tinkering with PG_autotune in an effort to make it usable on my > installation. > http://gborg.postgresql.org/project/pgautotune/projdisplay.php > > First off, thank you Justin for getting inspired and writing the starter > version. This is something that would probably have remained *way* down the > Postgres TODO list, were it not for you. Thats cool. :) > Since it's such a great idea, I'd like to make it bulletproof so that it can > become part of the standard Postgres distribution. I'm hoping that people > on this list can help. Hopefully. :) > Problems, Bugs, & Suggestions: > 1) The program makes the assumption that the Postgres superuser is named > "pgsql", forcing me to do a search-and-replace on the source to make it work > at all on my system, where the superuser is named "postgres". This should > be a configuration option. Places I've identified where this is an issue: > a. the connection to the "metrics" database, b. the calls to Postgres > executables (which are also sometimes made as the console user, causing them > to fail if you run the program as "root"). Good point. It was developed on FreeBSD, and the PostgreSQL superuser on FreeBSD (using the default installation method) is called "pgsql". On at least Solaris and Linux the most common name for the superuser appears to be "postgres". > 2) The program also assumes that all Postgres binaries are symlinked in > /usr/local/bin. Since this symlinking isn't done by Postgres-make-install, > wouldn't it be better to reference $PGHOME/bin? Yep. > 3) For that matter, it would be nice if the program would test $PGDATA and > $PGHOME, and prompt the user if they are empty. Good point. > 4) The shell scripts need to have error-checking so that they exit if anything > blows up. I can write this if Justin can explain what the shell scripts are > supposed to do, exactly, and where errors are acceptable. Ok, no problem. There are really only two shell scripts and a template. Forgot to include the template i n the downloadable version. :( Have to fix that soon. The shell scripts all reside in the $PGDATA directory and work like this: 1) The main shell script is called by the pg_autotune executable, and all it does is adjust the settings for a couple of variables in the postgresql.conf file. At present the variables it adjusts are max_connections, sort_mem, vacuum_mem and shared_buffers. Others could definitely be added in, but this is a start. The method used for adjusting the variables is to have a template postgresql.conf file with tokens for the settings to be replaced, and then parsing them with sed or awk or something. Can't remember offhand how, but I do remember it was a quick&ugly hack. :-/ Needs to be done properly down the track. 2) Restarts the PostgreSQL database (pg_ctl stop; pg_ctl start). Sure, long approach, but it works reliably. :) 3) The second shell script exists only to catch the output from the "pg_ctl start" command and then exit, as if you don't pipe the output to a valid process then the "pg_ctl start" doesn't appear to work properly. This was the only way I could see that would consistently work and not leave open filehandles around. > 5) We need installation docs. I can write these. Sometime soon, really! Cool. Lets do it. :) > Questions & Suggestions for Enhancement: > > 6) The shared_buffers param is capped at 500. Isn't this awfully low for a > production server? What's the logic here? They're just values that were ok to test with whilst making the program work. > 7) Any ideas on how to get around/adjust memory maximums for the host OS? > This is easy on Linux, but other *nixes are not so easy. Probably the best approach initially is to detect memory failure related errors where possible and then advise the user how to adjust them. Pointing to the relevant section of the PostgreSQL manual in the PostgreSQL Interactive Docs might be the way to go here. > 8) What will be the difficulties in expanding the script to adjust more > Postgresql.conf params, such as checkpoint_segments? Can we use feedback > from the log to adjust these? Good idea. As this tool is a reasonably brute force tester, the more parameters added could increase the time needed for testing, unless someone comes up with some bright ideas. :) > 9) I *love* the idea of letting the benchmarking script run custom queries. > However, I would dearly like to expand it, letting it randomly grab from a > list of 10 custom queries entered by the user into a file or files. This > would allow the user to create a realistic mix of simple and complex queries, > including some data manipulation and procedures. Hey good idea. The section of the code in place for letting the user run custom queries isn't yet finished, but it wouldn't take a half-decent coder long to do. > 10) Can we eventually adjust the program to get feedback from system tools and > give the user hints on hardware limitations? For example, have the program > test if, at maximum settings, queries are slow but CPU and RAM are only 10% > utilized and tell the user "Your hard drives are probably too slow"? Very good thought, and very worthwhile. Any idea how to start with it? > I can help with: documentation, shell scripting, Linux system issues. Other > volunteers to help? Hopefully. :) Regards and best wishes, Justin Clift > -- > -Josh Berkus > Aglio Database Solutions > San Francisco > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi