Hot answers tagged

11

I would use a series of with clauses: WITH some_stuff AS ( SELECT ... FROM ... INNER JOIN ... ON ... ), some_stuff_with_c AS ( SELECT *, a + b AS c FROM some_stuff ), some_stuff_with_d AS ( SELECT *, b + c AS d ) ... and wrap it all up in a view. I think this is pretty easy to understand, It's just a list of column definitions. ...


2

Important note: before trying to get your databases back, make sure you have a copy of all your .mdf and .ldf files somewhere safe. An .mdf file is a file which contains the actual data. You cannot “restore” anything from them, because they are not backups, thus Microsoft SQL Server tells you they are not valid backup files. What you can do is to recreate ...


2

In layman term's: Those tables are called historical tables, history tables or audit tables. The fact that you have a 12-month retention policy doesn't make them into a different type of table. The deletion (or not) of old historical data is part of the normal life-cycle of data.


2

What does a local database give you ? Referential integrity, atomicity and transactionality. I'd look at a serialisation mechanism for small applications, but as soon as you start maintaining sets of data, and particularly when you have to update subsets of that data, then I'd start looking at a local database. e.g. if you're looking to save a tree of data, ...


1

By that same argument, if you have 1,000 servers (and one database) you'll finish processing in (8 hours * 3600 seconds/hour / 1000 records = ) 28.8 seconds. That's clearly wrong. Table locks and I/O will become predominant long before all 1,000 servers start working. I would expect similar problems with 4 servers. A better approach is to do some careful ...


1

The question is already a bit aged, but maybe someone still stumbles upon it. Most of the mvc-based PHP frameworks offer a feature called scaffolding. With this feature you can easily create simple masks for CRUD operations. Instead of ids ususally a display-field is used for defining relations. I often use CakePHP to achieve what you describe, but it ...


1

I'm not sure there is a formal name for those sorts of tables. Data is normally cleared down to aid performance although (in the UK at least) you sometimes need to keep N years' worth for auditing purposes. If you have a data store in one database and have a highly performant database with a subset of the that data store for application or reporting ...


1

One of the methods I have used in the past to tremendously increase query performance is to pre-aggregate the data along one or more attributes (i.e., event type by day, event type by event name, etc.). This would be the equivalent of running a summation (for example) over the last month's data and storing the results in a separate table. This will allow ...


1

Cursors can be the preferred solution, but more often than not, they're [ab]used for logic that would be better implemented using joins, case statements, whiles etc. You state this logic: C = A + B D = C + B But is D really dependent on C? Could you not write all the derived columns as a series of long hand statements e.g. C = A + B D = A + B + B If ...



Only top voted, non community-wiki answers of a minimum length are eligible