Hi Andrey, Thanks for the update.
Unfortunately I am not sure that the last inserted record contains the bigger timestamp. Is there any way to get the result I need, with better performances, using the java api? Thanks, Fabrizio On Wednesday, March 5, 2014 10:20:40 AM UTC, Andrey Lomakin wrote: > > Hi Fabrizio, > You are right but current sql engine is weak for this. > Could you try following > select timestamp from myclass order by timestamp desc limit 1 > > This feature still is not implemented but will be fixed soon. > > > On Wed, Mar 5, 2014 at 12:25 AM, Fabrizio Fortino > <[email protected]<javascript:> > > wrote: > >> Hi guys, >> >> Working with OrientDB 1.6.4 I have noticed slowness when I perform the >> following query >> >> select max(timestamp) from myclass >> >> ----+-----+------------- >> # |@RID |max >> ----+-----+------------- >> 0 |#-2:0|1393969801000 >> ----+-----+------------- >> >> 1 item(s) found. Query executed in 0.819 sec(s). >> >> The class contains around 5000 record and the timestamp field is a LONG >> with a NOTUNIQUE index. >> >> Here is the explain plan >> >> Profiled command >> '{projectionElapsed:0,optimizationElapsed:0,groupByElapsed:0,current:#37:5019,fetchingFromTargetElapsed:524,documentReads:5020,documentAnalyzedCompatibleClass:5020,recordReads:5020,elapsed:524.391,resultType:collection,resultSize:1}' >> >> in 0.526000 sec(s): >> >> {"@type":"d","@version":0,"projectionElapsed":0,"optimizationElapsed":0, >> "groupByElapsed":0,"current":"#37:5019","fetchingFromTargetElapsed":524, >> "documentReads":5020,"documentAnalyzedCompatibleClass":5020,"recordReads" >> :5020,"elapsed":524.391,"resultType":"collection","resultSize":1, >> "@fieldTypes": >> "projectionElapsed=l,optimizationElapsed=l,groupByElapsed=l,fetchingFromTargetElapsed=l,documentReads=l,documentAnalyzedCompatibleClass=l,recordReads=l,elapsed=f" >> } >> >> >> Since the timestamp property in indexed should the query perform a "more >> smarter" search instead of reading all the documents in the class? >> >> Cheers, >> >> Fabrizio >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OrientDB" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Best regards, > Andrey Lomakin. > > Orient Technologies > the Company behind OrientDB > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
