I want to have an automatically updated structure in SQL Server that can handle aggregate queries well. Can I create an indexed view in SQL server 2014 that has a columnstore index as its clustered index?
You can't create a columnstore index on a view as per the documentation:
CREATE COLUMNSTORE INDEX (Transact-SQL)
In the limitations and restrictions it explicitly states:
"Cannot be created on a view or indexed view."
Related
In SQL Server 2016, I want to move ALL Clustered indexes in a DB to a secondary filegroup. What's the easiest way to do this?
This question is only for Nonclustered Indexes.
Moving all non-clustered indexes to another filegroup in SQL Server
Note: Want to retain Nonclustered indexes in same filegroup, and prevent creating additional unique indexes on primary key
In the process of optimizing an older legacy database
I am trying to create the indexes using the liquibase using following query in SQL Server.
CREATE NONCLUSTERED INDEX LASTNAME_IDX ON EMPLOYEE(UPPER(LAST_NAME));
But I am getting the error while running the liquibase. It works fine in oracle. Let me know if there a way I can create the index in SQL Server
SQL Server does not support function indices, which Oracle does support. One workaround here would be to create a computed uppercase column, and then index that:
ALTER TABLE EMPLOYEE ADD LAST_NAME_UPPER AS UPPER(LAST_NAME);
CREATE NONCLUSTERED INDEX last_name_idx ON EMPLOYEE(LAST_NAME_UPPER);
I could change the index property in one of the table from Unique, Non-Clustered, Filtered to Non-Unique, Non-Clustered in SQL Server on local machine. But I could NOT find any property in accessing Azure SQL Database via SQL Server MAnagement Studio.
How do I change in via TSQL?
After upgrading to latest SSMS 17.9.1, still not be able to change this via this tool So the query will drop first and then recreated:
DROP INDEX [IX_ClubApplicationUser_LastModifiedBy] ON [dbo].[ClubApplicationUser]
GO
CREATE NONCLUSTERED INDEX [IX_ClubApplicationUser_LastModifiedBy] ON [dbo].[ClubApplicationUser]
(
[LastModifiedBy] ASC
)
GO
This will change into NONCLUSTERED, NON-UNIQUE as well as NON-FILTERED.
The reason we change as the "Code First" approach in .NET CORE 2 generated automatically this type of index.
Can we create clustered/non-clustered columnstore index on a memory optimized table in SQL Server 2014?
Columnstore Index is not supported with memory optimized tables.
Nope, you can't create a columnstore index on a memory optimized table, only nonclustered hash and nonclustered indexes are allowed, see here for more details:
Guidelines for Using Indexes on Memory-Optimized Tables
ColumnStore indexes are going to be supported on Top on In-memory/hekaton tables in SQL Server 2016.
I was told that there is new a feature in SQL Server 2005 called index filters.
What I want to do is add an Index to a column and have the index ignore null values.
I can't find good information on this feature (maybe my source is wrong). Can anyone provide additional information on this feature?
CREATE INDEX ix_mytable_mycolumn ON mytable(mycolumn) WHERE mycolumn IS NOT NULL
This will work only in SQL Server 2008, though.
From the docs:
WHERE <filter_predicate>
Creates a filtered index by specifying which rows to include in the index. The filtered index must be a nonclustered index on a table. Creates filtered statistics for the data rows in the filtered index.
I think you are speaking about filtered indexes, which were introduced in SQL Server 2008, not 2005.
For information, have a look at this article: http://www.sql-server-performance.com/articles/dba/Filtered_Indexes_in_SQL_Server_2008_p1.aspx
Or just do a google search for "sql server filtered indexes".