clustered-index

SQL Server creating table with clustered index without a primary key

▼魔方 西西 提交于 2019-12-20 10:27:07
问题 Is it possible to create a clustered index from a create table statement in SQL Server 2008 that is not a primary key? The purpose of this is for a table in SQL Azure, so it is not an option for me to first create the table, and then create the clustered index on the table. Edit: Apparently it was FluentMigrator that was causing my problems, it's version table does not have a clustered index so it was erroring trying to create the versioning table not my table. 回答1: Yes, it is possible to

SqlExceptionHelper: Cursors are not supported on a table which has a clustered columnstore index

大憨熊 提交于 2019-12-20 04:10:15
问题 I'm trying to import data from DWH SQL server table which is using Clustered Columnstore Index into kudu through flume . However, after my custom flume source retrieves a certain number of rows from the database, this exception occurs: SqlExceptionHelper: Cursors are not supported on a table which has a clustered columnstore index I'm using JDBC SQL Server driver type 4, and apparently it uses cursors to iterate resultset. Therefore, I tried setting fetch size to the number the query is

Index is not getting applied on Indexed View

梦想与她 提交于 2019-12-20 01:10:25
问题 I have an indexed view but when I run queries on that view the index which is built on View is not applied and the query runs without index. Below is my dummy script: Tables + View+ Index on View CREATE TABLE P_Test ( [PID] INT IDENTITY, [TID] INT, [StatusID] INT ) CREATE TABLE T_Test ( [TID] INT IDENTITY, [FID] INT, ) CREATE TABLE F_Test ( [FID] INT IDENTITY, [StatusID] INT ) GO INSERT INTO F_Test SELECT TOP 1000 ABS(CAST(NEWID() AS BINARY(6)) %10) --below 100 FROM master..spt_values INSERT

SQL Server query to find clustered indexes

ε祈祈猫儿з 提交于 2019-12-18 16:40:35
问题 Is it possible to write a query that returns all tables that have clustered indexes that are not based on an identity key? 回答1: How about this: SELECT TableName = t.name, ClusteredIndexName = i.name, ColumnName = c.Name FROM sys.tables t INNER JOIN sys.indexes i ON t.object_id = i.object_id INNER JOIN sys.index_columns ic ON i.index_id = ic.index_id AND i.object_id = ic.object_id INNER JOIN sys.columns c ON ic.column_id = c.column_id AND ic.object_id = c.object_id WHERE i.index_id = 1 --

Clustered indexes on non-identity columns to speed up bulk inserts?

北慕城南 提交于 2019-12-17 19:39:36
问题 My two questions are: Can I use clustered indexes to speed up bulk inserts in big tables? Can I then still efficiently use foreign key relationships if my IDENTITY column is not the clustered index anymore? To elaborate, I have a database with a couple of very big (between 100-1000 mln rows) tables containing company data. Typically there is data about 20-40 companies in such a table, each as their own "chunk" marked by "CompanyIdentifier" (INT). Also, every company has about 20 departments,

Reasons not to have a clustered index in SQL Server 2005

落花浮王杯 提交于 2019-12-17 18:29:46
问题 I've inherited some database creation scripts for a SQL SERVER 2005 database. One thing I've noticed is that all primary keys are created as NON CLUSTERED indexes as opposed to clustered. I know that you can only have one clustered index per table and that you may want to have it on a non primary key column for query performance of searches etc. However there are no other CLUSTERED indexes on the tables in questions. So my question is are there any technical reasons not to have clustered

Should I get rid of clustered indexes on Guid columns

☆樱花仙子☆ 提交于 2019-12-17 15:53:30
问题 I am working on a database that usually uses GUIDs as primary keys. By default SQL Server places a clustered index on primary key columns. I understand that this is a silly idea for GUID columns, and that non-clustered indexes are better. What do you think - should I get rid of all the clustered indexes and replace them with non-clustered indexes? Why wouldn't SQL's performance tuner offer this as a recommendation? 回答1: A big reason for a clustered index is when you often want to retrieve

Difference between clustered and nonclustered index [duplicate]

落花浮王杯 提交于 2019-12-17 14:59:01
问题 This question already has answers here : What are the differences between a clustered and a non-clustered index? (12 answers) Closed 4 years ago . I need to add proper index to my tables and need some help. I'm confused and need to clarify a few points: Should I use index for non-int columns? Why/why not I've read a lot about clustered and non-clustered index yet I still can't decide when to use one over the other. A good example would help me and a lot of other developers. I know that I

What are the differences between a clustered and a non-clustered index?

不问归期 提交于 2019-12-17 06:57:12
问题 What are the differences between a clustered and a non-clustered index ? 回答1: Clustered Index Only one per table Faster to read than non clustered as data is physically stored in index order Non Clustered Index Can be used many times per table Quicker for insert and update operations than a clustered index Both types of index will improve performance when select data with fields that use the index but will slow down update and insert operations. Because of the slower insert and update

Changing GUID Primary Keys to Integer Primary Keys

烈酒焚心 提交于 2019-12-14 03:59:53
问题 I took over an application a few months ago that used Guids for primary keys on the main tables. We've been having some index related database problems lately and I've just been reading up on the use of Guids as primary keys and I've learnt how much of a bad idea they can be, and I thought it might pay to look into changing them before the database gets too large. I'm wondering if there's an easy way to change them to Ints? Is there some amazing software that will do this for me? Or is it all