Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Anton Shepelev Newsgroups: comp.databases.ms-sqlserver Subject: No covering indices for table types? Date: Fri, 12 Jul 2024 15:15:01 +0300 Organization: A noiseless patient Spider Lines: 38 Message-ID: <20240712151501.d23ddf433e73ae41365603cf@g{oogle}mail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Fri, 12 Jul 2024 14:15:01 +0200 (CEST) Injection-Info: dont-email.me; posting-host="55e98a94f8aeadee133388dad1642952"; logging-data="3182772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BD4v6O0jqZSlyh+4c3wkOjmGJjzGPF5U=" Cancel-Lock: sha1:7xF4StmskVvN6WnhRO3PavBTOvk= X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Xref: csiph.com comp.databases.ms-sqlserver:2259 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