[<<][sql][>>][..]
Fri Mar 2 20:25:46 EST 2012

Apache logs in database

After de-noobing a bit at work this week, I'm thikning that there
might be some simpler ways to do the key indirection I'm using a
Racket script for.

Basic problem: the logs are one big table, but the entries in the
table have a lot of duplicates.  Find a way to do automatic key
generation for the entries: if an entry doesn't exist yet, make up a
new key, otherwise reuse old.

The problem is that while (I think) I have some grasp about the
functional part of SQL (queries), I have no clue about the procedural
ones (updates).

The first thing is probably to find out how procedures work.


Wait..

This can be done functionally by creating a view.  ( As Gerard says:
Can't you create a view? )

1.  Just add the entry.
2.  Insert if not exists each column.
3.  Create a view that joins the hashed/indexed entries

( Which is the *inverse* of the operation I'm using to build the
indirect table in the first place! )

Then of course, this can be done simpler.

1.  INSERT IF NOT EXISTS each entry into its respective table.
2.  SELECT to find id
3.  insert main entry




[Reply][About]
[<<][sql][>>][..]