There are several advantages to running log analysis as a nightly job if you don't require real-time update of data:
You have control of the load on the web server and the database server caused by the
log analysis, ie. it is unaffected by traffic peaks. You can even move your log files off
to a different server for analysis after they've been rotated, if you like. This is very
useful if your app is running on multiple web servers.
You can perform aggregations on the data before inserting it to the database, if you require.
Several database engines support some kind of mass insertion which is much faster
than inserting the same data one record at a time.
Error handling (bugs in your analysis code, unavailable database etc.) is simpler -- just
rerun the same script on the relevant log data after the problem is fixed.
I'm sure there are others, depending on your requirements and hosting situation. Personally
I wouldn't even consider piping from Apache unless real-time updates were an absolute must,
and even then I would extract only what was needed in the piped script and handle everything
else with a nightly job.
If you're in need of a close to real-time solution, you should consider using a message queue
system (like ActiveMQ, for instance), and post messages to the queue through the Apache
log pipe.