Ricky,

This is doable but it can result in millions of rows if you do a lot of mass emailing.  If all you want is the gross
number of hits just use a single row:

update linkTable set counter = counter + 1 where link_id = 1

But if you are tracking the "who" (email address, ip address etc) then you will need a row per hit and your method is an
acceptable way to go.  watch out for triggers though - they are updating data on your database but they are easy to
forget about if they are not well documented somewhere. they don't readily "show up" - so down the road you can find
yourself perplexed as to why your data is changing - or at a loss trying to troubleshoot some performance issue.

-Mark

  -----Original Message-----
  From: Ricky Fritzsching [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 15, 2003 10:30 AM
  To: CF-Talk
  Subject: Incrementing counters in database

  I am in the process of developing an email tracking module that will
  track links initiated on by the recipient of the email broadcast. Each
  link with be associated with an ID and tracked back to a landing page in
  which I can increment counters for that particular link

  My question is what is the best performance option to run a counter in
  the database for each link. Should I just increment one column every
  time?

  OR

  Should I trigger the action to another table which will add an new row
  with the LINKID each time it is incremented? Then I could get the result
  by running a statement like this: SELECT COUNT(*) FROM TABLE WHERE
  LINK_ID = 1

  Hope this makes sense. Thx for your help.

  -----------------------
  Ricky Fritzsching


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to