Tag Info

New answers tagged

2

If a lot of your queries have conditions similar to what you describe, e.g. range condition on the date column: WHERE dateColumn >= (CURRENT_DATE() - INTERVAL 1 MONTH) WHERE dateColumn >= '2012-01-01' AND dateColumn < '2013-01-01' it will be useful to define the primary key of the table as (dateColumn, tableAI), where tableAI is an auto ...


0

Table joins are not costly, compared with the alternative, which is incorrect data due to storing the same data in multiple places. Split this into two tables, and if you need to find the most recent price for a set of products you can find the latest price efficiently with something like: select items.item_id , items.name , (select price ...


1

If you mix the history data in with the current like that in order to speed up queries over a time period, you do so at the expense of slowing down queries for current data. You can add an extra column to explicitly mark the relevant rows as the current prices (and have id+flag as the PK) but that adds extra work to your business logic to both keep it ...


1

Some thoughts.... Typically one does not want to store pieces of tightly interrelated information in different systems. The chances of things getting out of sync is significant and now instead of one problem on your hands you have two. One thing you can do with Mongo though is use it to pipeline your data in or data out. My preference is to keep ...


1

To access datas, is there other ways different from using SQL queries? Can we 'fire' events of DB engine without using SQL and get the datas in the storage? Sometimes you can, if the database engine offers such a mechanism. For example Pervasive PSQL is the descendant of the venerable Btrieve database. It allows you to use the "MicroKernel Database ...


1

You can also use your favorite hex editor :). This can even be a good learning lesson to see how things work under the hood. For example, you could have a look at those posts/videos: How does sql server store data by Brent Ozar; Corrupting Databases for Dummies- Hex Editor Edition by Kendra Little. But using a high level language like SQL or your vendors ...



Top 50 recent answers are included