-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Rick Bradley wrote: > * zdennis ([EMAIL PROTECTED]) [060716 20:33]: >> Could someone check this out and give some feedback? I have started to >> develop this as a separate plugin for ActiveRecord, but the more I think >> about it the more it seems that this sort of thing should be in core. >> Thoughts? > > Those are impressive speedups, and it would be interesting if they can > be made to apply generally.
I tried to extract what could be generalized across ActiveRecord::Base and AbstractAdapter rather then putting things into the concrete Adapter implementations like MysqlAdapter and PostgreSQLAdapter, but one of the things I rely on is asking the server how large a packet can be. After I figure this out I can optimize the number of insert statements based on the number of bytes a generated SQL statement would be. I think at minimum we just need a method to ask each concrete Adapter for the maximum number of allowed bytes. This is assuming that all servers support the standard SQL insert syntax for multi-value inserts of "VALUES ( 1 ), ( 2 ), ( 3 ), ( 4 ), ...." I can make that change and submit an updated patch tomorrow or Tuesday. > > Not commenting on the viability of the patch as a whole, but perhaps > rather than :fast / :fastest it would be better to drop :fast (which as > I understand it simply reduces the number of inserts required, behind > the scenes, without otherwise changing the create() behavior(?)) in > favor of a speedy default, and renaming :fastest (after all, what's > "fastest" now may well not be in the future) to be indicative of > function -- i.e., that it doesn't create the AR objects being created in > the database. Yeah it's been tough to determine what to call them. I had "good", "gooder" and "goodest" originally but I didn't know if other people would get the silly humor of it all. =) I have two options now (regardless of name) because although 'fast' will be optimized i don't have tests or benchmarks for it yet and I didn't want to submit a patch that would override existing behavior until that was done. I did want to provide complete indication of where this functionality was going though, and that is why I included it in the last email. Zach -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEuvClMyx0fW1d8G0RAr86AJ0Um57ETCqmGUKkjbXWSmTQthwv+QCfTAmU /kqOTUxejRys39pKAc+wHwY= =S9d1 -----END PGP SIGNATURE----- _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core