Re: SQL Query Performance tips - Mailing list pgsql-sql

From Michael Ossareh
Subject Re: SQL Query Performance tips
Date
Msg-id 5CCF98464386D4119F1200306E0050CC01447CA2@betauk.london.12snap.com
Whole thread Raw
In response to SQL Query Performance tips  (Michael Ossareh <michael.ossareh@12snap.com>)
List pgsql-sql
Hi PFC

Thanks for this! It has sped up complete - now in fact there is no delay!

A few tweaks had to be made to the code ; here it is:

select breakdown.alignment, sum(cnt) as num FROM
( (select alignment.name as class, count(1) as cntfrom weapons,alignmentwhere weapons.level < (select level_id from
userswhere uid =
 
$userid)and cost = 0and alignment.id = weapons.align_idgroup by alignment.name)
UNION ALL
select b.class as class, count(1) as cntfrom weapons w, user_weapons uu, alignment bwhere tu.weaponid = uu.weaponidand
uu.user_id= ($userid)and b.id = tu.idgroup by b.class ) as breakdown
 
group by breakdown.class;

Essentially you had skipped a few brackets and I had forgotten to note one
of the tables. It works!

Thanks a lot!!

Mike



pgsql-sql by date:

Previous
From: "Leeuw van der, Tim"
Date:
Subject: Re: [PERFORM] OFFSET impact on Performance???
Next
From: Alex Turner
Date:
Subject: Re: [PERFORM] OFFSET impact on Performance???