Re: [PERFORM] slow subselects

2007-02-19 Thread Tom Lane
"Marko Niinimaki" <[EMAIL PROTECTED]> writes: > I'm having a surprising performance problem with the following simple > 'highscore report' > select studentid, (select max(score) from > studentprofile prof where prof.studentid = students.studentid) from students; > I have indexes on students(stude

Re: [PERFORM] slow subselects

2007-02-19 Thread ismo . tuononen
try: select studentid,max(score) from studentprofile group by studentid; or if you want only those which exists in students select s.studentid,max(p.score) from studentprofile p,students s where s.studentid=p.studentid group by s.studentid; if it takes longer than 1-2 seconds something is seri

[PERFORM] slow subselects

2007-02-19 Thread Marko Niinimaki
Hello, I'm having a surprising performance problem with the following simple 'highscore report' select studentid, (select max(score) from studentprofile prof where prof.studentid = students.studentid) from students; I have indexes on students(studentid) and studentprofile(studentid). Row count

Re: [PERFORM] Query Optimization

2007-02-19 Thread Tom Lane
Reinhard Vicinus <[EMAIL PROTECTED]> writes: > PostgreSQL version: 8.1.6 > The following query needs a lot of time because the query planner > reorders the joins: Try reducing random_page_cost, increasing effective_cache_size, and/or updating to PG 8.2. Any of these are likely to make it like th

Re: [PERFORM] How to debug performance problems

2007-02-19 Thread Scott Marlowe
On Mon, 2007-02-19 at 12:18, Jeff Davis wrote: > On Mon, 2007-02-19 at 11:50 +0100, Andreas Tille wrote: > > Hi, > > > > I'm running a web application using Zope that obtains all data > > from a PostgreSQL 7.4 database (Debian Sarge system with package > > 7.4.7-6sarge4 on an "older" Sparc machine

Re: [PERFORM] How to debug performance problems

2007-02-19 Thread Jeff Davis
On Mon, 2007-02-19 at 11:50 +0100, Andreas Tille wrote: > Hi, > > I'm running a web application using Zope that obtains all data > from a PostgreSQL 7.4 database (Debian Sarge system with package > 7.4.7-6sarge4 on an "older" Sparc machine, equipped with 2GB Upgrade to 8.2.3 if possible, or at le

Re: [PERFORM] How to debug performance problems

2007-02-19 Thread Craig A. James
Andreas Tille wrote: My web application was running fine for years without any problem and the performance was satisfying. Some months ago I added a table containing 450 data rows ... Since about two weeks the application became *drastically* slower and I urgently have to bring back the old

[PERFORM] Query Optimization

2007-02-19 Thread Reinhard Vicinus
PostgreSQL version: 8.1.6 OS: Debian etch The following query needs a lot of time because the query planner reorders the joins: select m.message_idnr, v.headervalue, n.headername from dbmail_messages m join dbmail_headervalue v ON v.physmessage_id=m.physmessage_id join dbmail_headername n ON

[PERFORM] How to debug performance problems

2007-02-19 Thread Andreas Tille
Hi, I'm running a web application using Zope that obtains all data from a PostgreSQL 7.4 database (Debian Sarge system with package 7.4.7-6sarge4 on an "older" Sparc machine, equipped with 2GB memory and two processors E250 server). Once I did some performance tuning and found out that max