Index on Partitioned View

  • I have archive table and a 'live' table with the same table struture. I have created a view with a union of these 2 tables that is required for reporting. I cannot create a index on the view due to the UNION restriction. What are my other options ?

    This is the DDL of the table

    [ID] [int] IDENTITY(1,1) NOT NULL,

    [GLID] [varchar](20) NULL,

    [AccountID] [int] NULL,

    [Trx_Date] [datetime] NULL,

    [Debit] [decimal](19, 2) NULL,

    [Credit] [decimal](19, 2) NULL,

    [Source] [varchar](50) NULL,

    [Operation] [varchar](50) NULL,

    [GLTrxType] [tinyint] NOT NULL ,

    [GLTrxID] [int] NOT NULL ,

    [CreateDate] [datetime] NULL,

    [CreateUser] [varchar](20) NULL

  • Indexed views will persist the result of the view (as if it were a table). Assuming that the archive table is large, and the view is literally just the union of the two tables, is this really what you would like to do?

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Indexed views will persist the result of the view (as if it were a table).

    Does it mean that the index of the base table will be used when querying the view ?

  • I looked at the query execution plan for the view and it is using the underlying indexes of the tables.

    Thanks for your input.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply