Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am trying to figure out how to increment a number in a mysqlslap query with every iteratiom.

Let me explain what I exactly mean:

I got a query:

SELECT age FROM member WHERE id = [some number] 

is there a way to write mysqlslap parameter, so it iterates the [some number] while executing the query multiple time ? I do not want to keep doing the same query, as it caches.

I went through the documentation on http://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html but did not really find the straight answer to my question.

If there is not mysqlslap solution, maybe there is a way to achieve this with some other tool.

Cheers for help !

share|improve this question
    
when you say " I do not want to keep doing the same query, as it caches.", are you just concerned with the performance disregarding the query cache? –  Derek Downey Oct 15 '12 at 15:30
add comment

2 Answers

If you are worried about the performance effect of caching the result in the query cache, you can disable caching in your query by using SQL_NO_CACHE:

SELECT SQL_NO_CACHE age FROM member WHERE id = [some number]
share|improve this answer
add comment

I would consider the random function.

For instance:

select age 
from member 
where id = FLOOR(RAND()*10000)) 

In this example, 10000 is the maximum id value present in the table.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.