> dynamically, rather than statically like using paste.  One concern using
> paste to construct the SQL command is this: what about if the ID list in
> your sample becomes very large, is this a problem to construct this way?
> 


I have not messed with procedures in mysql 5, so I have no idea about the first
question.  However, the IN operator should be fast, even for large vectors.   
It takes me a second to retrieve 10,000 random records from a table with
100,000+ rows.

system.time(id.in( sample(1:100000, 10000) ))[3]
[1] 1.07


Also, I forgot to mention this before -  if your ID is a character field, you
can quote strings in the IN clause using the shell quote function.

paste(shQuote(ids),collapse=",")

Chris

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to