I don't mean to be a pain in the ass here, but this query (the
correlated one) takes less than a millisecond to process on MS SQL Server 2000:

 select symbol, change, price, trade_time, volume  from trade t1
where trade_id  =
  (
    select max(trade_id)from trade t2 where t1.symbol = t2.symbol
 )

 order by change

, opposed to the on below which take 0.681 seconds on SapDB. Same metadata and same 
data.

The performance difference is so big that it has to be something that is
not planned right by the optimizer, right? I mean, this is too slow...

Regards,

Dag


On Wed, 30 Jan 2002, Zabach, Elke wrote:

> Dag �yvind Liodden wrote
>
> > >
> > > > What is the best way to do this? Any ideas?
> > >
> > >     one idea (don't ask if this is the best):
> > >
> > >         select symbol, change, price, trade_time, volume
> > >           from trade t1
> > >         where (trade_id,symbol) = (select max(trade_id),symbol
> > >                                                  from trade t2
> > >                                                 group by symbol)
> > >
> > >      The you do NOT have a correlation
> >
> > This gives me an error: "More than one result row not allowed".
> >
>
> Sorry, change to
> ...symbol) =     any     (select
>
> Elke
> SAP Labs Berlin
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
>

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to