On Mar 23, 4:07 pm, Adam Perkins <[email protected]> wrote:
> Hello,
>
> I've been searching for the most appropriate and quickest way using
> Sequel to insert records in a table, from another table on the same
> server (even the same database at the moment). Number of rows could
> be from 5K-50K at a time.
>
> I wasn't sure if just creating a dataset, looping and creating/saving
> a new object would be the fastest?
It's fastest to do it on the server in a single query:
DB[:to_table].insert([:to_column1, :to_column2, ...],
DB[:from_table].select(:from_column1, :from_column2, ...))
This does:
INSERT INTO to_table (to_column1, to_column2, ...)
SELECT from_column1, from_column2, ... FROM from_table
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.