ok, two questions then.
1) my code in the past doesn't use using or dispose (because i relied on the GC). What is the penalty for not calling Dispose or using 'using'? Future code should use using/dispose but my old code is ok with the automatic garbage collection, right?
2) Dispose is...
Hi,
I've been reading a bit about the using statement.
ie
using (TextWriter w = File.CreateText("log.txt"))
{
w.WriteLine("This is line one");
}
My understanding is that this code will call the Dispose() method of w at the end of the using block. None of my previous code has ever...
yeah, I'm not a big fan of keeping the historical data and the transactional data tied together the way I suggested in the last method. Still, in my particular case, it is not such a big deal. I really appreciate both yours and mrdenny's help. It has definately made a difference on this...
This idea is essentially what you suggested ESquared, except that there is not a separate table. I know that you would prefer a separate table for security/data integrity purposes and I should look into that a bit further before finalizing this but seems to be the way to go
Hey, you guys are really helping me think out of the box here. I think I've come up with the final solution (which is kind of similar to ESquared's idea).
In my original table, I have a reference to the current historical data id. So I have the following
Transaction DB table
TableA...
Wow...I am impressed. You knew that I missed you post (I'm assuming because I was doing mine at the same time).
ok, my original plan was to have a trigger on table A that does an insert into HIS_TableA each time something is inserted or updated in table A. This trigger would handle updating...
You have been a really big help to me, getting me to run the tests and see what happens (I don't know why I sometimes don't think of these things myself:).
Anyway, I need to update IsCurrent requently now to maintain the current record. With the index on IsCurrent, this is pretty slow. I...
sure
Execution Plan for method 1
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.0" Build="9.00.3042.00">
<BatchSequence>
<Batch>
<Statements>
<StmtSimple StatementText="SELECT * FROM [test_IsCurrent] WHERE [IsCurrent]=@1"...
Ok, so I did some testing. I set up 3 tables with the same data
Table 1 and Table 2
HIS_ID Uniqueidentifier (Primary Key)
ID Uniqueidentifier (INDEXED)
DateInserted DateTime (INDEXED)
AND
Table 3
HIS_ID Uniqueidentifier (Primary Key)
ID...
I found another method to do this on the web using rank and partition
create table #test (testid int identity(1,1), personid int, persondate int)
insert into #test (personid, persondate) values (1, 1)
insert into #test (personid, persondate) values (1, 2)
insert into #test (personid...
hmmm...yeah, I really should learn how to read an execution plan it seems. I was hoping one of those methods would stand out and be the obvious way to do it (I'm assume the bit method would have better performance since it doesn't need to use any subqueries) but I guess it is something that I...
Good thought. However, I forgot to mention that the databases have the ID fields as GUIDs so max(HistoricalTableAID) doesn't actually give the most recent value
I have a database that is storing historical data. It actually consists of two databases. There is a transactional database that contains all the current records, and then a historical database that contains all records over all periods of time. It is set up as follows
Transaction DB table...
Hi,
I have been working as a contractor for an engineering company and now they want to hirer me into the software department where I will become the department head. Of course, the 'department' currently only consists of me, and one other programmer. The problem is the company I work for is...
I have a web app that is running from a SQL Server 2005 database. Periodically, the app generates a timeout error, but if I run the command from management studio, it takes less than a second. Furthermore, the timeout error appears to happen randomly and does not occur with only a specific...
Lets see...I figured I could do something like
SELECT d.* FROM Deficiencies d
INNER JOIN
(SELECT Max(DeficiencyID) as CurrentDefID FROM Deficiencies
GROUP BY OriginalID) c
ON c.CurrentDefID = d.DeficiencyID
Perhaps not the most beautiful query ever but does the job. And with the view...
That is a nifty little trigger. I might use that for our system but I'm still not entirely sure which method to go with. That trigger could be useful for both.
I have been thinking about this the same way as you have. A co-worker explained to me that for method 1, you don't have to keep...
I should mention that I am by no means an expert in using the terminology OLAP and OLTP. I have created lots of fully normalized databases for handling short term transactions (so, I assume this is OLTP) and I have also created a star schema database that was only for reporting but that is my...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.