[PERFORM] Lower Random Access Time vs RAID 0 / 1

2007-03-22 Thread Michael Ben-Nes
Hello I plan to buy a new development server and I wonder what will be the best HD combination. I'm aware that best combination also relay on DB structure and usage. so lets assume, heavy duty large DB with mostly reads and heavy write actions from time to time ( updates / huge transactions ).

[PERFORM] Performance of count(*)

2007-03-22 Thread Andreas Tille
Hi, I just try to find out why a simple count(*) might last that long. At first I tried explain, which rather quickly knows how many rows to check, but the final count is two orders of magnitude slower. My MS_SQL server using colleague can't believe that. $ psql InfluenzaWeb -c 'explain SELECT

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Andreas Kostyrka
* Andreas Tille [EMAIL PROTECTED] [070322 12:07]: Hi, I just try to find out why a simple count(*) might last that long. At first I tried explain, which rather quickly knows how many rows to check, but the final count is two orders of magnitude slower. Which version of PG? The basic

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Albert Cervera Areny
As you can see, PostgreSQL needs to do a sequencial scan to count because its MVCC nature and indices don't have transaction information. It's a known drawback inherent to the way PostgreSQL works and which gives very good results in other areas. It's been talked about adding some kind of

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread ismo . tuononen
explain is just quessing how many rows are in table. sometimes quess is right, sometimes just an estimate. sailabdb=# explain SELECT count(*) from sl_tuote; QUERY PLAN

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread ismo . tuononen
approximated count? why? who would need it? where you can use it? calculating costs and desiding how to execute query needs approximated count, but it's totally worthless information for any user IMO. Ismo On Thu, 22 Mar 2007, Albert Cervera Areny wrote: As you can see, PostgreSQL

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Andreas Tille
On Thu, 22 Mar 2007, Andreas Kostyrka wrote: Which version of PG? Ahh, sorry, forgot that. The issue occurs in Debian (Etch) packaged version 7.4.16. I plan to switch soon to 8.1.8. That's the reason why PG (check the newest releases, I seem to remember that there has been some aggregate

[PERFORM] Potential memory usage issue

2007-03-22 Thread David Brain
Hi, I recently migrated one of our large (multi-hundred GB) dbs from an Intel 32bit platform (Dell 1650 - running 8.1.3) to a 64bit platform (Dell 1950 - running 8.1.5). However I am not seeing the performance gains I would expect - I am suspecting that some of this is due to differences I

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Andreas Kostyrka
* Andreas Tille [EMAIL PROTECTED] [070322 13:24]: On Thu, 22 Mar 2007, Andreas Kostyrka wrote: Which version of PG? Ahh, sorry, forgot that. The issue occurs in Debian (Etch) packaged version 7.4.16. I plan to switch soon to 8.1.8. I'd recommend 8.2 if at all possible :) That's the

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Bill Moran
In response to [EMAIL PROTECTED]: approximated count? why? who would need it? where you can use it? calculating costs and desiding how to execute query needs approximated count, but it's totally worthless information for any user IMO. I don't think so. We have some AJAX stuff

Re: [PERFORM] Potential memory usage issue

2007-03-22 Thread Bill Moran
In response to David Brain [EMAIL PROTECTED]: I recently migrated one of our large (multi-hundred GB) dbs from an Intel 32bit platform (Dell 1650 - running 8.1.3) to a 64bit platform (Dell 1950 - running 8.1.5). However I am not seeing the performance gains I would expect What were you

Re: [PERFORM] Potential memory usage issue

2007-03-22 Thread David Brain
Hi, Thanks for the response. Bill Moran wrote: In response to David Brain [EMAIL PROTECTED]: I recently migrated one of our large (multi-hundred GB) dbs from an Intel 32bit platform (Dell 1650 - running 8.1.3) to a 64bit platform (Dell 1950 - running 8.1.5). However I am not seeing the

Re: [PERFORM] Potential memory usage issue

2007-03-22 Thread Bill Moran
In response to David Brain [EMAIL PROTECTED]: Thanks for the response. Bill Moran wrote: In response to David Brain [EMAIL PROTECTED]: I recently migrated one of our large (multi-hundred GB) dbs from an Intel 32bit platform (Dell 1650 - running 8.1.3) to a 64bit platform (Dell 1950 -

[PERFORM] Parallel Vacuum

2007-03-22 Thread Dimitri
Folks, is there any constrains/problems/etc. to run several vacuum processes in parallel while each one is 'vaccuming' one different table? Example: vacuum -d db1 -t table1 vacuum -d db1 -t table2 vacuum -d db1 -t table3 wait (sorry if it was already asked, but I did not find an

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Merlin Moncure
On 3/22/07, Andreas Tille [EMAIL PROTECTED] wrote: I just try to find out why a simple count(*) might last that long. At first I tried explain, which rather quickly knows how many rows to check, but the final count is two orders of magnitude slower. You can get the approximate count by

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Michael Stone
On Thu, Mar 22, 2007 at 01:30:35PM +0200, [EMAIL PROTECTED] wrote: approximated count? why? who would need it? where you can use it? Do a google query. Look at the top of the page, where it says results N to M of about O. For user interfaces (which is where a lot of this count(*) stuff

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Jonah H. Harris
On 3/22/07, Merlin Moncure [EMAIL PROTECTED] wrote: As others suggest select count(*) from table is very special case which non-mvcc databases can optimize for. Well, other MVCC database still do it faster than we do. However, I think we'll be able to use the dead space map for speeding this

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Mario Weilguni
Am Donnerstag, 22. März 2007 15:33 schrieb Jonah H. Harris: On 3/22/07, Merlin Moncure [EMAIL PROTECTED] wrote: As others suggest select count(*) from table is very special case which non-mvcc databases can optimize for. Well, other MVCC database still do it faster than we do. However, I

Re: [PERFORM] Lower Random Access Time vs RAID 0 / 1

2007-03-22 Thread Ron
1= a better HD comparison resource can be found at www.storagereview.com http://www.storagereview.com/comparison.html You will find that storagereview has better information on any and all things HD than Tom's does. 2= DB servers work best with as many spindles as possible. None of your

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Michael Fuhr
On Thu, Mar 22, 2007 at 01:29:46PM +0100, Andreas Kostyrka wrote: * Andreas Tille [EMAIL PROTECTED] [070322 13:24]: Well, to be honest I'm not really interested in the performance of count(*). I was just discussing general performance issues on the phone line and when my colleague asked me

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Michael Stone
On Thu, Mar 22, 2007 at 09:39:18AM -0400, Merlin Moncure wrote: You can get the approximate count by selecting reltuples from pg_class. It is valid as of last analyze. Of course, that only works if you're not using any WHERE clause. Here's a (somewhat ugly) example of getting an approximate

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread mark
On Thu, Mar 22, 2007 at 10:18:10AM -0400, Michael Stone wrote: IIRC, that's basically what you get with the mysql count anyway, since there are corner cases for results in a transaction. Avoiding those cases is why the postgres count takes so long; sometimes that's what's desired and

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Luke Lonergan
Andreas, On 3/22/07 4:48 AM, Andreas Tille [EMAIL PROTECTED] wrote: Well, to be honest I'm not really interested in the performance of count(*). I was just discussing general performance issues on the phone line and when my colleague asked me about the size of the database he just wonderd

Re: [PERFORM] Parallel Vacuum

2007-03-22 Thread Dimitri
On Thursday 22 March 2007 14:52, Alvaro Herrera wrote: Dimitri escribió: Folks, is there any constrains/problems/etc. to run several vacuum processes in parallel while each one is 'vaccuming' one different table? No, no problem. Keep in mind that if one of them takes a very long time,

Re: [PERFORM] Parallel Vacuum

2007-03-22 Thread Alvaro Herrera
Dimitri escribió: On Thursday 22 March 2007 14:52, Alvaro Herrera wrote: Dimitri escribió: Folks, is there any constrains/problems/etc. to run several vacuum processes in parallel while each one is 'vaccuming' one different table? No, no problem. Keep in mind that if one of

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Andreas Kostyrka
* Mario Weilguni [EMAIL PROTECTED] [070322 15:59]: Am Donnerstag, 22. März 2007 15:33 schrieb Jonah H. Harris: On 3/22/07, Merlin Moncure [EMAIL PROTECTED] wrote: As others suggest select count(*) from table is very special case which non-mvcc databases can optimize for. Well, other

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Craig A. James
Michael Stone wrote: On Thu, Mar 22, 2007 at 01:30:35PM +0200, [EMAIL PROTECTED] wrote: approximated count? why? who would need it? where you can use it? Do a google query. Look at the top of the page, where it says results N to M of about O. For user interfaces (which is where a lot of

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Tino Wildenhain
Craig A. James schrieb: ... In our case (for a variety of reasons, but this one is critical), we actually can't use Postgres indexing at all -- we wrote an entirely separate indexing system for our data, one that has the following properties: 1. It can give out pages of information (i.e.

Re: [PERFORM] Potential memory usage issue

2007-03-22 Thread Tom Lane
Bill Moran [EMAIL PROTECTED] writes: In response to David Brain [EMAIL PROTECTED]: I am curious as to why 'top' gives such different output on the two systems - the datasets are large and so I know I benefit from having high shared_buffers and effective_cache_size settings. Have you done

Re: [PERFORM] Parallel Vacuum

2007-03-22 Thread Dimitri
On Thursday 22 March 2007 16:12, Alvaro Herrera wrote: Dimitri escribió: On Thursday 22 March 2007 14:52, Alvaro Herrera wrote: Dimitri escribió: Folks, is there any constrains/problems/etc. to run several vacuum processes in parallel while each one is 'vaccuming' one

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Carlos Moreno
count(*). I was just discussing general performance issues on the phone line and when my colleague asked me about the size of the database he just wonderd why this takes so long for a job his MS-SQL server is much faster. [...]. Simple. MSSQL is optimized for this case, and uses older

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Brian Hurt
Craig A. James wrote: One of our biggest single problems is this very thing. It's not a Postgres problem specifically, but more embedded in the idea of a relational database: There are no job status or rough estimate of results or give me part of the answer features that are critical to

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Mario Weilguni
Am Donnerstag, 22. März 2007 16:17 schrieb Andreas Kostyrka: * Mario Weilguni [EMAIL PROTECTED] [070322 15:59]: Am Donnerstag, 22. März 2007 15:33 schrieb Jonah H. Harris: On 3/22/07, Merlin Moncure [EMAIL PROTECTED] wrote: As others suggest select count(*) from table is very special

Re: [PERFORM] Potential memory usage issue

2007-03-22 Thread David Brain
Bill Moran wrote: Install the pg_bufferstats contrib module and take a look at how shared memory is being use. I like to use MRTG to graph shared buffer usage over time, but you can just do a SELECT count(*) WHERE NOT NULL to see how many buffers are actually in use. Can you explain what

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Craig A. James
Brian Hurt wrote: One of our biggest single problems is this very thing. It's not a Postgres problem specifically, but more embedded in the idea of a relational database: There are no job status or rough estimate of results or give me part of the answer features that are critical to many

Re: [PERFORM] Potential memory usage issue

2007-03-22 Thread Bill Moran
In response to David Brain [EMAIL PROTECTED]: Bill Moran wrote: Install the pg_bufferstats contrib module and take a look at how shared memory is being use. I like to use MRTG to graph shared buffer usage over time, but you can just do a SELECT count(*) WHERE NOT NULL to see how

Re: [PERFORM] Parallel Vacuum

2007-03-22 Thread Michael Stone
On Thu, Mar 22, 2007 at 04:55:02PM +0100, Dimitri wrote: In my case I have several CPU on the server and quite powerful storage box which is not really busy with a single vacuum. So, my idea is quite simple - speed-up vacuum with parallel execution (just an algorithm): Vacuum is I/O

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Craig A. James
Tino Wildenhain wrote: Craig A. James schrieb: ... In our case (for a variety of reasons, but this one is critical), we actually can't use Postgres indexing at all -- we wrote an entirely separate indexing system for our data... ...There is no need to store or maintain this information along

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Tino Wildenhain
Craig A. James schrieb: Tino Wildenhain wrote: Craig A. James schrieb: ... In our case (for a variety of reasons, but this one is critical), we actually can't use Postgres indexing at all -- we wrote an entirely separate indexing system for our data... ...There is no need to store or

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Michael Stone
On Thu, Mar 22, 2007 at 06:27:32PM +0100, Tino Wildenhain wrote: Craig A. James schrieb: You guys can correct me if I'm wrong, but the key feature that's missing from Postgres's flexible indexing is the ability to maintain state across queries. Something like this: select a, b,

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Steve Atkins
On Mar 22, 2007, at 10:21 AM, Craig A. James wrote: Tino Wildenhain wrote: Craig A. James schrieb: ... In our case (for a variety of reasons, but this one is critical), we actually can't use Postgres indexing at all -- we wrote an entirely separate indexing system for our data...

Re: [PERFORM] Parallel Vacuum

2007-03-22 Thread Dimitri
Mike, you're right until you're using a single disk :) Now, imagine you have more disks - more I/O operations you may perform, and you'll need also a CPU time to process them :) until you fully use one CPU per 'vacuumdb' - and then you stop... As well, even in case when CPU is not highly

Re: [PERFORM] Potential memory usage issue [resolved]

2007-03-22 Thread David Brain
Thanks Bill for the explanation - that really helped me out considerably. What this showed me was that there were only 1024 buffers configured. I'm not quite clear as to how this happened as the postgresql.conf files on both systems have the shared_buffers set to ~5. However it looks as

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Merlin Moncure
On 3/22/07, Michael Stone [EMAIL PROTECTED] wrote: On Thu, Mar 22, 2007 at 06:27:32PM +0100, Tino Wildenhain wrote: Craig A. James schrieb: You guys can correct me if I'm wrong, but the key feature that's missing from Postgres's flexible indexing is the ability to maintain state across queries.

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Guido Neitzer
On 22.03.2007, at 11:53, Steve Atkins wrote: As long as you're ordering by some row in the table then you can do that in straight SQL. select a, b, ts from foo where (stuff) and foo X order by foo limit 10 Then, record the last value of foo you read, and plug it in as X the next time

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Tom Lane
Craig A. James [EMAIL PROTECTED] writes: Steve Atkins wrote: As long as you're ordering by some row in the table then you can do that in straight SQL. select a, b, ts from foo where (stuff) and foo X order by foo limit 10 Then, record the last value of foo you read, and plug it in as X

Re: [PERFORM] Parallel Vacuum

2007-03-22 Thread Michael Stone
On Thu, Mar 22, 2007 at 07:24:38PM +0100, Dimitri wrote: you're right until you're using a single disk :) Now, imagine you have more disks I do have more disks. I maximize the I/O performance by dedicating different sets of disks to different tables. YMMV. I do suggest watching your I/O

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Michael Stone
On Thu, Mar 22, 2007 at 02:24:39PM -0400, Merlin Moncure wrote: Tino was saying that rather that build a complete indexing storage management solution that lives outside the database, it is better to do intelligent session management so that you get the simplicity if a two tier client server

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Craig A. James
Tom Lane wrote: Craig A. James [EMAIL PROTECTED] writes: Steve Atkins wrote: As long as you're ordering by some row in the table then you can do that in straight SQL. select a, b, ts from foo where (stuff) and foo X order by foo limit 10 Then, record the last value of foo you read, and plug

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Tino Wildenhain
Michael Stone schrieb: On Thu, Mar 22, 2007 at 02:24:39PM -0400, Merlin Moncure wrote: Tino was saying that rather that build a complete indexing storage management solution that lives outside the database, it is better to do intelligent session management so that you get the simplicity if a

Re: [PERFORM] Performance of count(*)

2007-03-22 Thread Tino Wildenhain
Craig A. James schrieb: Tino Wildenhain wrote: You guys can correct me if I'm wrong, but the key feature that's missing from Postgres's flexible indexing is the ability to maintain state across queries. Something like this: select a, b, my_index_state() from foo where ... offset 100

[PERFORM] Sunfire X4500 recommendations

2007-03-22 Thread Matt Smiley
My company is purchasing a Sunfire x4500 to run our most I/O-bound databases, and I'd like to get some advice on configuration and tuning. We're currently looking at: - Solaris 10 + zfs + RAID Z - CentOS 4 + xfs + RAID 10 - CentOS 4 + ext3 + RAID 10 but we're open to other suggestions. From