Re: [SQL] [GENERAL] working around setQuerySnapshot limitations in functions

2002-12-16 Thread Jakub Ouhrabka
Hi, I'm no expert on this but I think that some cases can be work around using foo updates instead of selects. See threads "LOCK TABLE oddness in PLpgSQL function called via JDBC" and "SetQuerySnapshot, once again" in the archives. But I think there is no general work around using only plpgsql. I'

Re: [SQL] order by and limit with multi-column index, bug?

2002-12-13 Thread Jakub Ouhrabka
hi, could it be that "order by col1, col2 desc" is different from "order by col1 desc, col2 desc" ? these are different and it's correct. i'm not sure if this is your problem since i haven't digged into it... sorry... but check it to be sure... hth, kuba On Fri, 13 Dec 2002, Harald Krake wro

Re: [SQL] why the difference?

2002-11-21 Thread Jakub Ouhrabka
hi, the where clause is evaluated before the distinct clause, so your queries aren't equivalent because you switched the order by splitting the query into two queries... so to obtain same results do create table as select ... where category_id=781 and then select distinct on () ... hth, kuba

Re: [SQL] [HACKERS] please help on query

2002-07-12 Thread Jakub Ouhrabka
hi, avoid subselect: create a temp table and use join... CREATE TEMP TABLE tmp AS SELECT lineitem.orderkey FROM lineitem WHERE lineitem.orderkey=orders.orderkey GROUP BY lineitem.orderkey HAVING sum(lineitem.quantity)>300; CREATE INDEX tmp_idx ON tmp (orderkey);

Re: [SQL] [HACKERS] please help on query

2002-07-12 Thread Jakub Ouhrabka
hi, avoid subselect: create a temp table and use join... CREATE TEMP TABLE tmp AS SELECT lineitem.orderkey FROM lineitem WHERE lineitem.orderkey=orders.orderkey GROUP BY lineitem.orderkey HAVING sum(lineitem.quantity)>300; CREATE INDEX tmp_idx ON tmp (orderkey);