Sunday, March 12, 2006

Replacing Perl with MySQL and maybe Oracle XE

I have a series of Perl scripts which use Perl modules to perform some statistical calculations of stock market End-Of-Day (EOD) data. I had the prospect of writing a Perl script to return the values of statistics calculation.
So I decided it was time to convert from flat files to storing the data in a database. So I downloaded MySQL 5.1 and installed on a box running Ubuntu. It was a reasonably straight forward process, I had some fun and games with having the default data directory in /var/lib.
This was solved by shutting down MySQL (mysqladmin shutdown -u root -p), moving the files to a more appropriate location and creating a symbolic link (directory) pointing at the new location.
The next problem was the lack of some important statistical functions such as correlation. I had a look around on the net and found that Oracle has the ANSI SQL standard CORR(x,y) function.
So off the www.oracle.com to download Oracle XE.
Given the box in question has 512M of RAM, the 1Gig limit isn't a problem. Plus I will get the CORR function and plenty of other analytical functions to boot.

The next step is get the grips with the loading of data, most likely with external tables. The MySQL function LOAD INFILE 'filename' INTO table is very easy to understand and use.

Have Fun

Paul

No comments: