Hacker News new | ask | show | jobs
by arthole 6344 days ago
because your fuzzy allocation is going to change from table to table, it would probably be best to keep a master table of fuzzy allocations.

something along the lines of

columnname, lowvalue, highvalue, weight

that way, you could keep all your weightings for whatever column you wanted to test on and do your joins on the low and high values.

it would also make it easier to modify your weightings and see how the queries you generate change their results without having to change any sql. And if you wanted multiple kinds of weightings for one column name you would just add a name field.

eg:

create table fuzzy (name VARCHAR(10) NOT NULL, colname VARCHAR(30) NOT NULL, lowval DECIMAL(10,2) NOT NULL, hival DECIMAL(10,2) NOT NULL, weight DECIMAL(10,2) NOT NULL, PRIMARY KEY (name, colname, weight), INDEX fuzzy1 (name, colname, weight), INDEX fuzzy2 (name, colname, lowval, hival), INDEX fuzzy3 (name, colname, hival, lowval) );