Hello I was reading this column on persisted columns on sql 2k5.
This looks like a solution for sift tables.
You could instead of sift table use persisted fields.
Anybody ever thought about this?
Here is an example
CREATE TABLE [dbo].[Invoice_Table](
[Invoice#] [int] IDENTITY(1,1) NOT NULL,
[Invoice_Amount] [money] NOT NULL,
[Invoice_Freight] [money] NOT NULL,
[Invoice_Total] AS ([Invoice_Amount]+[Invoice_Freight]) PERSISTED
) ON [PRIMARY]
CREATE NONCLUSTERED INDEX [Invoice_Total_Idx] ON [dbo].[Invoice_Table]
(
[Invoice_Total] ASC
) ON [PRIMARY]
In navsion world the nonclustered index would be [invoice no,Invoice_Total] . And the persistant field will equal the actual field instead of adding two fields. That way summing up on the value is done on the key, and not on the data. That way you don't need sift tables at all.
:-k
Here is an article about this.
http://www.sql-server-performance.com/bm_adding_indexes_persisted.asp
Comments
I ran test on this on sql and running a sum statement on PERSISTED fields is slower than the actual fields.
Here are the steps I took.
In First statement I created the table. with the key.
Then I populated the tabel with 100K random records
Ran the following statement to sum on actual field.
This took 400 ms.
Then I ran
This took 183 milliseconds. Almost in half.
hmmmm
I'll next create a navision table and will post the results. I'm doubt sift table will be slower.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
The results are now the opposite. Persisted field take longer than actual fields. About 2 and half times longer than the actual fields.
Hope this answers your question.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!