Yes. By keeping data in separate tables, you're making more work for yourself. Databases are good at aggregating information, and it's easiest if all of the data is in a single table.
If I was doing this, I'd keep add a (non-key) field to hold the date, and would keep all data in a single file. Then, I could do something like
to do aggregate calculations. OrSELECT sum(somefield) FROM table WHERE datefield BETWEEN ? AND ?
if I needed the aggregates to apply to distinct dates.SELECT datefield, sum(somefield) FROM table WHERE datafield BETWEEN ? AND ? GROUP BY datefield
Flushing old data is easy.
These are all static queries. By keeping all data in a single table, I don't have to reconstruct new queries to plug in a dynamic table name. And I'm letting the database do the aggregate calculations, rather than pulling all of the data over the wire to the client and doing it there.DELETE from TABLE WHERE datafield < ?
If your particular calculations are more complicated, and can't be done in SQL, you may still be able to do part of the aggregation on the server side, reducing the amount of data you have to pull across the wire into the client.
In reply to Re: Re: Re: Ignore Relation already exists error from DBI
by dws
in thread Ignore Relation already exists error from DBI
by global
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |