0

I have two tables A and B.Table A consists of status and created timestamp.Table B stores actions taken on Table A. (Every day at least hundred thousand records get stored into Table A).

I have to update status in table A if timestamp of the particular row doesn't belong to last week and insert the particular action in table B.

What are the best practices to solve this problem?

DO i have to run mysql script cron jobs or through java program(we use java in our project)?

Tab Alleman
  • 31,483
  • 7
  • 36
  • 52
Manu
  • 317
  • 4
  • 16
  • according your question the answer is - yes, you have to use sql query, executed from cron, or from java runned by cron. rewrite your question – xdd Jun 15 '16 at 14:02

1 Answers1

1

It is a design decision, both solutions can work well.

Choose the simplest to be developed for your knowledge and the simplest to be mantained.

A little tip on the database. If you have many data and you need to search only on the last week you can partition your table to get fastest results.

Davide Lorenzo MARINO
  • 26,420
  • 4
  • 39
  • 56