Groups | Search | Server Info | Login | Register


Groups > comp.databases.ms-sqlserver > #2259

No covering indices for table types?

From Anton Shepelev <anton.txt@g{oogle}mail.com>
Newsgroups comp.databases.ms-sqlserver
Subject No covering indices for table types?
Date 2024-07-12 15:15 +0300
Organization A noiseless patient Spider
Message-ID <20240712151501.d23ddf433e73ae41365603cf@g{oogle}mail.com> (permalink)

Show all headers | View raw


Hello, all.

I wanted to create a convenient table-type for storing time
series (with possibly non-uniqe sample marks):

  CREATE TYPE series_t AS TABLE
  (  moment DATETIME NOT NULL,
     value  FLOAT
  )

For efficient querying and joining, I need a covering index
on the [moment] field that includes [value], but the INCLUDE
keyword does not seem to be suported:

  https://learn.microsoft.com/en-us/sql/t-sql/statements/create-type-transact-sql

so that I can only create a simple non-convering column
index:

  CREATE TYPE series_t AS TABLE
  (  moment DATETIME NOT NULL INDEX moment,
     value  FLOAT
  )

or a compound table index for both columns:

  CREATE TYPE series_t AS TABLE
  (  moment DATETIME NOT NULL,
     value  FLOAT
     INDEX Main(moment, value)
  )

What is best practice in cases when a covering index is
required for a tale-type?

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments

Back to comp.databases.ms-sqlserver | Previous | NextNext in thread | Find similar


Thread

No covering indices for table types? Anton Shepelev <anton.txt@g{oogle}mail.com> - 2024-07-12 15:15 +0300
  Re: No covering indices for table types? Erland Sommarskog <esquel@sommarskog.se> - 2024-07-12 23:48 +0200
    Re: No covering indices for table types? Anton Shepelev <anton.txt@g{oogle}mail.com> - 2024-07-15 14:27 +0300

csiph-web