Last active
November 2, 2016 15:19
-
-
Save mskutta/6be0ff1bc6657323665aa444a5ba584a to your computer and use it in GitHub Desktop.
Sorting Sitecore Items by Popularity using xDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE [dbo].[Fact_Views] DROP CONSTRAINT [FK_Fact_Views_Items] | |
GO | |
/****** Object: Table [dbo].[Fact_Views] Script Date: 8/22/2016 8:44:14 AM ******/ | |
DROP TABLE [dbo].[Fact_Views] | |
GO | |
/****** Object: Table [dbo].[Fact_Views] Script Date: 8/22/2016 8:44:14 AM ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE TABLE [dbo].[Fact_Views]( | |
[ItemId] [uniqueidentifier] NOT NULL, | |
[Date] datetime NOT NULL, | |
[TemplateId] [uniqueidentifier] NOT NULL, | |
[Count] [bigint] NOT NULL | |
CONSTRAINT [PK_Fact_Views] PRIMARY KEY CLUSTERED | |
( | |
[ItemId] ASC, | |
[Date] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
ALTER TABLE [dbo].[Fact_Views] WITH NOCHECK ADD CONSTRAINT [FK_Fact_Views_Items] FOREIGN KEY([ItemId]) | |
REFERENCES [dbo].[Items] ([ItemId]) | |
GO | |
ALTER TABLE [dbo].[Fact_Views] CHECK CONSTRAINT [FK_Fact_Views_Items] | |
GO | |
CREATE NONCLUSTERED INDEX [IX_Fact_Views_ByTemplateDate] ON [dbo].[Fact_Views] | |
( | |
[TemplateId] ASC, | |
[Date] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) | |
GO | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment