Prev | Current Page 265 | Next

David Berube

"Practical Reporting with Ruby and Rails"

In fact, as you??™ll see when we examine the completed solution later in this
chapter, the code that inserts Apache log data using this extension will perform at triple
the speed of Active Record alone. If you have a more complex situation??”with a number
of keys or with a large amount of data being read at a time, for example??”it will speed up
processing even more.
For more details on ActiveRecord::Extensions, see http://www.continuousthinking.
com/are/activerecord-extensions-0-0-5.
nTip Actually, the fastest way to do MySQL inserts is by using the LOAD DATA INFILE statement. This
requires your data to be on disk in CSV format, however. In some cases, you can convert data from another
format, write it as CSV, and then load it with LOAD DATA INFILE. This will still be faster than using separate
INSERT statements, but the additional complexity may not be worth it, particularly if you??™re dealing with
dynamic data from, say, a user filling out a form on a web site. Also, LOAD DATA INFILE has the disadvantage
of being MySQL-specific, and you need to place the CSV file on the server or else deal with some
security issues.


Pages:
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
boiler service london dieta light pozycjonowanie portal pozycjonowanie