MySQL Forums
Forum List  »  Performance

does this "top-200" query do a table scan
Posted by: Andrew Nuss
Date: October 27, 2015 05:50AM

I have a table "Article_t" with two particular columns:

"id_c" and progressMade_c", both of which are configured as "bigint"

id_c is the primarykey

progressMade_c is always initially zero, but when work begins on a row, it is updated to be the current timestamp in millis, until finally done, when it becomes the maximum positive value.

Aside from the primary key index, I have an index on (progressMade_c, id_c)

The basic idea is that I want an efficient query that not only fetches virgin (unworked on records) but also records whose "munging" failed to finish in a reasonable amount of time.

Does this query do a table scan, or if so, at least a very efficient one?

select id_c from Article_t where progressMade_c < :maxvalue limit 200

where :maxvalue is set to some parameter equal to the current timestamp minus 10 minutes?

Basically this is a "top-200" query of articles to work on, with the idea being that I want the minimum id values to be returned.



Options: ReplyQuote

Written By
does this "top-200" query do a table scan
October 27, 2015 05:50AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.