Re: [SQL] How to optimize this query?

2006-03-22 Thread Jeffrey Melloy
Maciej Piekielniak wrote: Hello Markus, Oryginal query return 7881 rows , your query only 729 rows. But it's faster! ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if

Re: [SQL] pgsql aggregate: conditional max

2006-03-11 Thread Jeffrey Melloy
Weimao Ke wrote: Hi, I need a special aggregation function. For instance, given the following table data: aid| cat | weight --+-+- a1 | Drama | 1 a1 | Romance | 6 a1 | Short | 1 a1 | Other | 7 a2 | Comedy | 1 a2 | Dram