If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Database Design for Transaction Filters

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-18-11, 20:17
victorhooi victorhooi is offline
Registered User
 
Join Date: Dec 2011
Posts: 1
Database Design for Transaction Filters

Hi,

We have a transaction processing system that checks transactions, and accepts or rejects them based on certain criteria.

Currently, this system uses two database tables. There are no FK relationships, or DB validation rules at the moment - the program just uses text comparisons - I'm hoping to change that.

The first table provides criteria to match transactions on the source, account and state:

Weight Source Account State Tag
1 Foo Bob A Filter1
5 Foo Jane A Filter2
50 Bar Bob A Filter1
200 Bar Bob B Filter3

Each rule is assigned a "weight" - the rules are processed in order of weight, falling to the subsequent line if it doesn't match each line. The actual number chosen for weight is arbitrary.

Once we finds a match, we take the tag and consult a second table

Tag Minimum Maximum Step
Filter1 0 50 5
Fitler1 50 150 10
Filter1 150 20000 5
Filter2 0 100 15
Filter2 100 2000 5
Filter2 2000 100000 5
Filter3 0 100000 10

Each filter tag has multiple records. We find the one where our transaction amount falls between minimum and maximum, and where step applies (this is based on price movements). If we find a matching row, we let the transaction through, otherwise we reject it.

If however, our transaction doesn't fall between any of the min/max amounts, or the stepping doesn't match, we also reject that transaction.

Note that in the first table, each tag can occur multiple times - each rule falls through from top to bottom.

In the second table, each tag can also occur multiple times - each tag will have different min/max/step values.

Also, each tag may be used by different clients, hence the separation into two tables.

My question is to the database gurus out there - what's the best way to design these tables to take better advantage of the database, and provide some better validation?

I assume there's a M2M relationship between the two tables - with the intermediary table storing 'tag', right?

Is there a better way of storing the above?

Cheers,
Victor
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On