In this chapter, you??™ll see how to create a custom report to analyze web site traffic
and sales, based on a high volume of data in Apache logs. For this example, you will use
Gruff, which was introduced in Chapter 3, plus two new tools: ActiveRecord::Extensions
and PDF::Writer. Let??™s begin by looking at what these two tools can do for you.
189
C H A P T E R 1 0
Speeding Up Insertions with
ActiveRecord::Extensions
ActiveRecord::Extensions is, as the name implies, a collection of extensions for Active
Record. These are generally performance extensions. The extension you??™ll use in this
chapter??™s example allows you to insert multiple rows of data at a time into a single table.
This will speed up performance significantly and can reduce memory use, since you
won??™t need to create large numbers of objects. Since the example calls for inserting large
numbers of records into a database from the Apache log, this performance boost will be
significant.
ActiveRecord::Extensions is very easy to use. Let??™s take a look at a brief example to see
how it works.
Pages:
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274