SQL 2012 :: How To Fragment Index

Mar 20, 2015

how to fragment an index so I can test it's fragmented performance on an iSCSI LUN.I can test without an index, that's fine. I can test with a newly created index (of course that means it's not fragmented) and that's fine.But what I want to do is DELIBERATELY FRAGMENT () an index to 90%+ fragmented to test it's performance.

View 4 Replies


ADVERTISEMENT

Please Verify This SQL Fragment

Aug 24, 2007

Will someone please help verify this SQL fragment?

I want to ensure that it produces the same results as the 'Group By' clause of the MS Access fragment below.

T-SQL:



Group By Case




When r.LICFAC In ('CR', 'GC') And f.SOPNO < 38 Then -1

Else 0

End

, Case


When r.LICFAC = 'MU' And f.SOSTS <> '05' Then -1

Else 0
End



MS Access:

GROUP BY IIf((([LICFAC]="CR" Or [LICFAC]="GC") And ([SOPNO]<38)),True,False)
, IIf(([LICFAC]="MU") And ([SOSTS]<>"05"),True,False)

View 5 Replies View Related

SQL 2012 :: Full Text Index How To Make It NOT To Index Embedded Or Attached Documents

Sep 30, 2015

I am using Full Text Index to index emails stored in BLOB column in a table. Index process parses stored emails, and, if there is one or more files attached to the email these documents get indexed too. In result when I'm querying the full text index for a word or phrase I am getting reference to the email containing the word of phrase if interest if the word was used in the email body OR if it was used in any document attached to the email.

How to distinguish in a Full Text query that the result came from an embedded document rather than from "main" document? Or if that's not possible how to disable indexing of embedded documents?

My goal is either to give a user an option if he or she wants to search emails (email bodies only) OR emails AND documents attached to them, or at least clearly indicate in the returned result the real source where the word or phrase has been found.

View 0 Replies View Related

SQL Server 2008 :: Indexes Fragment Really Quickly

May 1, 2015

This application runs on a SQL Server 2008 R2 database.This application receives messages from an integration module. It has a core table: Table-A. Each message is inserted as 1 row into Table-A. Then when it is processed, that row in Table-A is updated.

There are two environments which are both connected to the same integration. So in both environments, Table-A has exactly the same amount of records inserted and updated. In both environments Table-A has around 80 million rows, with an extra 150,000 rows being inserted and then updated every day.Table-A has 8 indexes. For some reason unknown to me, the 8 indexes fragment really quickly in one environment but not in the other.

e.g. In Environment-1 the index fragmentation ranges from 0 - 19% and this environment has not been re-indexed for over 2 months.BUT a reindex was performed in Environment-2 and only 2 days later the index fragmentation ranges from 72 - 99.93%!

Our DBA has confirmed the re-index in Environment-2 completed successfully and has shown stats before and after the reindex to show that the 8 indexes for Table-A in Environment-2 went down to 0% fragmentation.

My question is, how can the indexes in Environment-2 fragment so much more quickly than the indexes in Environment-1? Both environments are on exactly the same hardware and have exactly the same inbound messages. The database on Environment-1 is actually a clone from Environment-2. The only known differences between the 2 databases is Environment-1 is STANDARD edition - SQL Server 2008 R2 (SP2) whereas Environment-2 is ENTERPRISE edition - SQL Server 2008 R2 (SP1). Could this difference be due to the Service Pack levels or even because one is STANDARD and the other ENTERPRISE?

This is what I have checked so far:

1) In both Environments all 8 indexes have "Set Fill Factor" unchecked and "Automatically recompute statistics", "Use row locks...", "Use page locks..." checked.
2) The "Index Usage Statistics" report in both Environments shows a similar amount of #UserUpdates and #UserScans

View 9 Replies View Related

SQL 2012 :: Clustered Index Key Order In NC Index

Mar 5, 2015

I have a clustered index that consists of 3 int columns in this order: DateKey, LocationKey, ItemKey (there are many other columns in this data warehouse table such as quantities, prices, etc.).

Now I want to add a non-clustered index on just one of the other columns, say LocationKey, like this:
CREATE INDEX IX_test on TableName (LocationKey)

I understand that the clustered index keys will also be added as key columns to any NC indexes. So, in this case the NC index will also get the other two columns from the clustered index added as key columns. But, in what order will they be added?

Will the resulting index keys on this new NC index effectively be:

LocationKey, DateKey, ItemKey
OR
LocationKey, ItemKey, DateKey

Do the clustering keys get added to a NC index in the same order as they are defined in the clustered index?

View 1 Replies View Related

SQL 2012 :: Need To Reorg Index?

Mar 24, 2014

I have a table with primary key and also clustered index on that primary key column. I need almost all columns from that table. When I wrote the select column names, it showing that Index scan occurred. How can I avoid that Index scan and change to index seek? When I check the fragmentation of that Index it is showing more than 34%. Is that fragmentation is ok or do I need to reorg the Index?

View 5 Replies View Related

SQL 2012 :: CI And NC Index On Same Column?

May 5, 2014

I have a question regarding indexes.

If i have cluster and NC index on same column,does it degrade performance on DML statements ? any advantage on select statements.

Is it good to have both indexes on same column ?

View 3 Replies View Related

SQL 2012 :: Index Was Out Of Range

Oct 1, 2014

observed below error in sqlserver2012.index was out of range. Must be non-negative and less than the size of the collection.

View 2 Replies View Related

SQL 2012 :: Index Was Outside Bounds Of Array

Nov 12, 2013

I am experiencing of problem relating to the error message on the production SQLServer2012;

Index was outside the bounds of array. (Microsoft.SqlServer.Smo)

View 5 Replies View Related

SQL 2012 :: Clustered Index Delete

Mar 28, 2014

I want to know more details about the Clustered Index Delete. Is that Clustered Index Delete in the execution plan is good or bad or we can neglect that cost. Is there any way to avoid that clustered Index delete operator from the execution plan.

View 4 Replies View Related

SQL 2012 :: Columnstore Index - Add All Columns?

Mar 31, 2014

When creating a column store index, are there any reasons not to include all columns, besides index size of course? i.e. will the index be more versatile with more columns or should I treat it exactly like its a standard index, putting only necessary columns, in the correct order?

View 1 Replies View Related

SQL 2012 :: Cluster Index Fragmentation

Jun 2, 2014

We have few tables where we do truncate load or only do insert activities , why do the cluster index get fragmented very often to > 80%?

View 9 Replies View Related

SQL 2012 :: Index Outside Bounds Of Array

Jun 11, 2014

When I go to SQL 2012 through SSMS 2005, I get the message Index outside the bounds of array. Will it fix if I install SSMS 2012? Do I need to remove SSMS 2005?

View 1 Replies View Related

SQL 2012 :: Selecting A Clustered Index?

Jul 29, 2014

- What are your thoughts on adding clustered index on datetime (createdDate , native GUID) column. The data will be be physically organized in the clustered index allowing range operations to perform its duties. But will the GUID column make any impact ( drawbacks) should it be made part of the clustered key ?

The GUID column will provide the lookup with the required indexes to support.

View 3 Replies View Related

SQL 2012 :: Column Not Covered By Index?

Jan 15, 2015

We have a large table with many columns and many indexes. One poorly performing query is having to do a key lookup when the where clause includes a particular column with no covering index.

Are you generally better off adding a new index or adding the column to an existing index ( included columns )Column: LAST_STATE_RESPONSE_CODE

The Query Processor estimates that implementing the following index could improve the query cost by 88.9332%.

*/
/*
USE [ database name]
GO
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[SERVICE_REQUEST] ([BUSINESS_PROCESS_STATUS],[[color=#F00]LAST_STATE_RESPONSE_CODE[size="3"][/size][/color]],[CONCRETE_TYPE])
INCLUDE ([LIENHOLDER_PERFORMING_LIEN_FILING_ID],[MAKE],[YEAR],[MANUFACTURER_ID],[CLIENT_ID])
GO

View 4 Replies View Related

SQL 2012 :: Index Creation On Predicates

Jan 16, 2015

I was reading this blog below about Indexed Views and needed some clarification.

When the author choose to create the unique clustered index he excluded the PER.BusinessEntityID columns and only included, (CustomerID, SalesOrderID, ProductID).

Why didn't the PER.BusinessEntityID get added?

[URL] ....

CREATE VIEW Sales.vSalesSummaryCustomerProduct
WITH SCHEMABINDING
AS
SELECT CUST.CustomerID ,
SOH.SalesOrderID ,
SOD.ProductID ,
SUM(SOD.OrderQty) AS TotalOrderQty ,

[Code] .....

View 2 Replies View Related

SQL 2012 :: Is Non Clustered Index Getting Always Scanned Useful

Mar 16, 2015

I created a NC index as suggested by missing index DMV(of course I don't create them blindly). This one seemed to be a useful index but I now see from index usage stats that it only got scanned 50 times in 4 days.No seeks, no lookups. So is it a good idea keeping such index.The table on which this index is created is used more for reads and less for writes.

View 6 Replies View Related

SQL 2012 :: Column For Clustered Index

Apr 16, 2015

Is it always the best practice to have the partition column also as the column for clustered index?

View 2 Replies View Related

SQL 2012 :: Index On Calculated Field With UDF?

May 11, 2015

is it possible to have a field that is calculated using a User Defined Function, and index that field?

View 9 Replies View Related

SQL 2012 :: Can Add Index To Table Type

Jun 23, 2015

This is my table type definition ( below ) and as you see I declared a table whose name is in @t

/*
CREATE TYPE BP_Data_ACRC_427
as table
(
AIMS_VALUE_NUMERIC numeric(19,2),
bp_type VARCHAR(4),
Dt datetime,
ID int IDENTITY(1,1),
MBP numeric(19,2),
MPOG_PHYSIOLOGIC_CONCEPT_ID VARCHAR(10)
)
*/

Declare @t as BP_Data_ACRC_427

Question: can we add an index that combines AIMS_VALUE_NUMERIC and Dt

View 6 Replies View Related

SQL 2012 :: Index Maintenance For Large Tables?

Mar 8, 2014

We are having very big tables in TBS and wanted to setup a strategy for index maintenance.

View 3 Replies View Related

SQL 2012 :: Script To List All Index In One Table

Mar 14, 2014

How to create a script to input one table name(already indexed) to get list of all index for that table?

View 5 Replies View Related

SQL 2012 :: Find All Index And Creation Date

Mar 27, 2014

I need to find all the index and the creation date. I did cross apply of sys.objects & Sys.indexes on name column. I am getting some but the team is saying they created so many. Any other option to find Indexes and their creation date?

View 2 Replies View Related

SQL 2012 :: Included Columns In Non-clustered Index

May 8, 2014

I am trying to tune a process that is running slowly. I analyzed the process using the Database Engine Tuning Advisor, and it recommended the creation of 3 indexes, all non-clustered:

1) ColA, include ColB
2) ColA, include ColC
3) ColA, include ColD

So... I created a single non-clustered index on:

4) ColA, include ColB, ColC, ColD

That should do the same thing, right? A look at my execution plan shows that the index I created is being scanned -- 3 times. What is puzzling me, though, is that the Database Engine Tuning Advisor is still recommending I create these 3 separate indexes, even with the index (4) that I created in existence.

If it matters, ColA, ColB, ColC and ColD are all int FKs.

View 2 Replies View Related

SQL 2012 :: Index Maintenance And Update Stats

Jul 22, 2014

I am using Ola Hallengrens scripts for index and stats maintenance but I am wondering what most people to in terms of the maintenance schedules. At present we do an index rebuild reorg weekly, but do people also do update stats nightly?

I suppose there is an element of "it depends" here in that the data may be fairly static so the update stats may not be required, or if heavily updated then perhaps rebuilding indexes may be required more frequently.

View 5 Replies View Related

SQL 2012 :: Error - Index Was Outside The Bounds Of The Array

Sep 2, 2014

Currently underway with migrating from SQL 2005 to SQL2012. I have loaded all of my SSRS reports into Visual Studio 2010 (SQL Server Data Tools) and they all appeared to upgrade fine. I have 150+ reports and I'm in the middle of recreating a tonne of Subscriptions.

However, I have 4 reports that run fine, execute nicely.... but as soon as I click on 'Subscriptions' I get the index bounds array error.

I could attempt to re-create them. It's only 4 reports after all. But it doesn't answer the question, why would the reports execute fine, but unable to create a subscription?

View 0 Replies View Related

SQL 2012 :: Cost Of Clustered Index Insert Is 100%?

Sep 7, 2014

how to reduce the cost of clustered index insert ?

View 8 Replies View Related

SQL Server 2012 :: 42% Of 100% Taken In Clustered Index Insert

Dec 1, 2014

I have a query which is primarily a victim of blocking and a blocker itself for other queries. I studied the plan for this and it shows a 42% cost on CI insert operation. The insert is happening on a table (Table A) that has a PK. This PK is not a running number. It is also a business key (primary key) in another master table (Table B).

My understanding is that the cost is heavy because -

1, this PK is not an incremental number. It could be any number not in a sequence.
2. while inserting into CI, there must be a scan happening to find out the location where the index will be inserted.

How can I reduce the cost?

1. Should I go for partitioning of this table Table A? I am trying to do this but I am not able to find any suitable partition key looking at the JOINS and filter clauses where this table is being used in the applicaiton.
2. Should I introduce a surrogate key (running number) as a primary key so that CI is faster ?

View 9 Replies View Related

SQL 2012 :: PDF Not Found In FT-Index On File Table

Dec 15, 2014

I have a filetable and use a statement like

SELECT [name],file_stream
FROM dbo.Inkoopfacturen
WHERE FREETEXT(file_stream, 'Factuur');

It will return the text found in a .pptx but not in a pdf. There are no errors in the FT-log. It tells me that the FT-index is succesfully build.

I have downloaded the iFilter for Adobe (installed it in a folder with a short name), set the temp variable to the bin folder of the installation.

I've executed the following queries:

EXEC sp_fulltext_service 'update_languages';
EXEC sp_fulltext_service 'load_os_resources', 1;
EXEC sp_fulltext_service 'restart_all_fdhosts';
Exec sp_fulltext_service 'verify_signature', 0

When I run the following statement, it'll show pdf in the resultset.

SELECT * FROM sys.fulltext_document_types order by document_type

Still, content is not found.

View 5 Replies View Related

SQL 2012 :: Possible Sources Of Fragmentation On Clustered Index

Jan 23, 2015

I have a table that has a clustered index that is only the identity column on the table. The table is somewhere around 200K rows and has 3800 pages in the index. We run our index maintenance every other day on this database using Ola's scripts and this index is rebuilt because it is 40-60% fragmented after 2 days. Overall, this isn't really too much of a problem since the index rebuild doesn't take too long, but I am puzzled as to how this index is getting fragmented since the only column in it is the identity.

CREATE TABLE [dbo].[Example](
[ExampleID] [int] IDENTITY(1,1) NOT NULL,
[ExampleCode] [varchar](10) NOT NULL,
[ForeignID] [int] NOT NULL,
[AnotherID] [int] NOT NULL,

[code]...

) ON [PRIMARY]There is nothing strange like updates to the identity happening and while some records are deleted, there has only been about 20,000 in the life of the table (months). Not enough to account for the level of fragmentation that we're seeing on the index.About the only thing I can think of that would cause fragmentation on this index in this scenario are:

1. Page splits caused by starting with a small value in one of the VARCHARs and later inserting a larger value
2. Page splits caused by the NULLABLE column, ExampleDate, starting with NULLs and later updating them to a date.

For #1, I had development check the update scenarios for the varchar columns, especially the varchar(1000) one, and they didn't see it as a common thing where the values would go from small (or empty) to large.

For #2, I checked and found that the only value for that column in the table is NULL so while it always starts as NULL, it never gets updated to anything else.

I've tried looking at sys.dm_db_index_operational_stats and the leaf_update_count is around 300,000, but unless those updates are causing page splits, I don't see how they would contribute to fragmentation.

View 9 Replies View Related

SQL 2012 :: Selectivity Value Of A Table To Create Index?

Feb 18, 2015

Why should we consider selectivity of a table to create index?

Which is best selectivity value to create an index ?

View 3 Replies View Related

SQL Server 2012 :: Unique Index On Table

Mar 20, 2015

I am trying to create a unique index on a table such that the combination of 2 columns is unique. How do I go about that?

View 5 Replies View Related

SQL 2012 :: Clustered Index Defrag Not Working

Apr 15, 2015

I have a clustered index which shows as having a fragmentation level of 66% according to sys.dm_db_index_ physical_ stats.avg_ fragmentation_ in_ percent.

But no matter what I try the fragmentation level doesn't budge. And yes I'm updating the statistics after each attempt.Its not a huge issue the table only has 348 records. I'm testing a fixing fragmentation maintenance script. In Ironing out the syntax of my script I've fixed the fragmentation of indexes of over 65 % anyway..I've come across and index that I can't defragment. I've tried

ALTER INDEX ALL ON [GRIDINFO] REBUILD WITH (FILLFACTOR = 90)

I've tried

ALTER INDEX ALL ON [GRIDINFO] REORGANIZE

I've tried

DBCC INDEXDEFRAG (MYDATABASE, 'GRIDINFO', PK__GRIDINFO__3214EC2721F5FC7F);

The command complete successfully yet the avg_fragmentation_in_percent doesn't change. The table also has a nonclustered index. I've gleaned through all the statements of 'this will have no effect if' but so far I've not spotted a reason why this index won't defrag.The script has been modified to remove schema and database names for the forum.

dbcc showcontig('GRIDINFO','IDX_GRIDINFO1') with tableresults , all_levels
go
DBCC SHOWCONTIG ('GRIDINFO')
go
sp_helpindex 'GRIDINFO'

[code]....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved