Re: SQL Query Performance tips

From: Michael Ossareh <michael(dot)ossareh(at)12snap(dot)com>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: SQL Query Performance tips
Date: 2005-01-26 13:02:19
Message-ID: 5CCF98464386D4119F1200306E0050CC01447CA2@betauk.london.12snap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 cnt
from weapons,
alignment
where weapons.level < (select level_id from users where uid =
$userid)
and cost = 0
and alignment.id = weapons.align_id
group by alignment.name)
UNION ALL
select b.class as class, count(1) as cnt
from weapons w, user_weapons uu, alignment b
where tu.weaponid = uu.weaponid
and uu.user_id = ($userid)
and b.id = tu.id
group 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

Browse pgsql-sql by date

  From Date Subject
Next Message Joel Fradkin 2005-01-26 13:28:48 Re: same question little different test MSSQL vrs Postgres
Previous Message Sibtay Abbas 2005-01-26 11:06:47 Re: working with multidimensional arrays in plpgsql