Re: [R] RMySQL question, sql with R vector or list

From: Chris Stubben <>
Date: Tue, 05 Jun 2007 18:53:40 +0000 (UTC)

> 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( 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.


Chris mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Jun 2007 - 19:34:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Jun 2007 - 20:33:34 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.