[UPHPU] automatic calculation procedure?

Ray Hunter bigdog at venticon.com
Tue Aug 29 23:48:34 MDT 2006


Connor Boyack wrote:
>> 1. where is the data stored that is input into the calculations?
> 
> Each listing has a datestamp, as well as a rating (like the number of
> "diggs", essentially), number of inbound links, and other such data.  All
> are stored in the database in the same table.

if you are limited to a specific db this will influence your decision drastically.

>> 2. where does the result from the calculations need to go?
> 
> When the calculation is performed, the algorithm needs to decide if a
> certain listing is to be flagged.  So, only the listings that aren't
> currently flagged will be analyzed.  Those that meet the criteria will need
> to have their database entries modified (to change the flag boolean from
> false to true).

this sounds like something i am currently working on. here are some options that
i decided to persue.

i use pgsql and i have written a trigger that provides me with an fire before
insert - this means that i will fire the trigger before i insert into the table.
in the trigger i call a stored procedure that takes (method params) the data to
be insert into the table and then runs through the algorithms that i have
defined.  by running this in the database and added certain restrictions like
unique key, foreign key constraints, and default values i am able to handle this
at the db level and not have something query the db.

my reason for this is that i am already in the database when i run the trigger
and function and that i do not have to set up any external (outside the db) tool
to do the calculations for me. this also helps with speed and performance issues.

im not sure what db you are using, but it might be worth looking into.

--
ray


More information about the UPHPU mailing list