Re: SQL Query Performance tips
От | Michael Ossareh |
---|---|
Тема | Re: SQL Query Performance tips |
Дата | |
Msg-id | 5CCF98464386D4119F1200306E0050CC01447CA2@betauk.london.12snap.com обсуждение исходный текст |
Ответ на | SQL Query Performance tips (Michael Ossareh <michael.ossareh@12snap.com>) |
Список | 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 по дате отправления: