Hello Monty,

Thank you for your note and feedback.

After getting excellent assistance, I'm using JDBC setMaxRows rather than
LIMIT, which gives me portability.

I'll investigate SQL_CALC_FOUND_ROW option further.  I notice I would need
to first upgrade to MySQL 4.x, though and then find / work out how to use it
with JDBC.  It would be great to do only one query, which means the
processing would be reduced from approx. 25 to 4 seconds.  I'd say, that is
a great reduction.

Kind regards
Emmanuel

> -----Original Message-----
> From: Michael Widenius [mailto:[EMAIL PROTECTED]]
> Sent: 21 January 2002 00:44
> To: Emmanuel van der Meulen
> Cc: MySQL General List; MySQL Java List
> Subject: RE: Understanding throughput with JDBC
>
>
>
> Hi!
>
> >>>>> "Emmanuel" == Emmanuel van der Meulen <[EMAIL PROTECTED]> writes:
>
> Emmanuel> Hello Mark,
> Emmanuel> Thank you for the note and feedback.  BTW, it was not
> over a network.  Both
> Emmanuel> on local PC.  So all the time went into building the
> resultset in memory.
> Emmanuel> I'm surprised at the time that takes.
>
> Emmanuel> Further to why I'm desirous to do this query, twofold.
> One I get the record
> Emmanuel> count (rows in the table); since realised there are
> other ways to get he
> Emmanuel> number of rows.  For the second requirement I cannot
> see an alternative.
> Emmanuel> Not on this table, but on another where I keep a
> timestamp, I'd like to get
> Emmanuel> the 50 most recent inserts.  So what I do is; (SELECT * FROM
> Emmanuel> MEMBERSHIPSTRACKING ORDER BY ACTIVITYTIMESTAMP DESC)
> thus get all the rows,
> Emmanuel> ordered desc on timestamp and then I have the most
> recent 50 inserts.  If
> Emmanuel> anyone could assist me with this, I'd use other means,
> rather than
> Emmanuel> retrieving the full resultset.
>
> Why can't you use 'LIMIT 50' to get the latest 50 rows ?
> (As Mark asked, why do you have to use LIMIT 10000)
>
> You can also use SQL_CALC_FOUND_ROW option to avoid to do two queries,
> if you want to know how many rows the WHERE statement actually matched
> (see the MySQL manual for more information about this topic).
>
> Regards,
> Monty
>
> --
> For technical support contracts, goto https://order.mysql.com/
>    __  ___     ___ ____  __
>   /  |/  /_ __/ __/ __ \/ /    Mr. Michael Widenius <[EMAIL PROTECTED]>
>  / /|_/ / // /\ \/ /_/ / /__   MySQL AB, CTO
> /_/  /_/\_, /___/\___\_\___/   Helsinki, Finland
>        <___/   www.mysql.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to