473,606 Members | 2,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing Tuning Wizard Indexes

Just curious if anyone has a script to find and delete all indexes
created by index tuning wizard, leaving the original indexes untouched.
All of the original indexes in this particular database are preceded
with IX_, whereas those created by ITW are the table name followed by a
number.

I'm thinking of something along the lines of "sp_MSforeachta ble
@command1="prin t '?'" + a DBCC which just targets the ITW indexes (if
such a thing exists). Any ideas how to go about this?
Jul 20 '05 #1
3 2551

"crystal1" <cr******@spaml ess.net> wrote in message
news:ci******** @enews3.newsguy .com...
Just curious if anyone has a script to find and delete all indexes created
by index tuning wizard, leaving the original indexes untouched. All of the
original indexes in this particular database are preceded with IX_,
whereas those created by ITW are the table name followed by a number.

I'm thinking of something along the lines of "sp_MSforeachta ble
@command1="prin t '?'" + a DBCC which just targets the ITW indexes (if such
a thing exists). Any ideas how to go about this?


You could execute the output of a query like this (see "sysindexes " in Books
Online):

select 'drop index ' + object_name(id) + '.' + name
from sysindexes
where indid not in (0,255)
and name like object_name(id) + '[0-9]%'

Simon
Jul 20 '05 #2
"Simon Hayes" <sq*@hayes.ch > wrote in message news:<41******* ***@news.bluewi n.ch>...
"crystal1" <cr******@spaml ess.net> wrote in message
news:ci******** @enews3.newsguy .com...
Just curious if anyone has a script to find and delete all indexes created
by index tuning wizard, leaving the original indexes untouched. All of the
original indexes in this particular database are preceded with IX_,
whereas those created by ITW are the table name followed by a number.

I'm thinking of something along the lines of "sp_MSforeachta ble
@command1="prin t '?'" + a DBCC which just targets the ITW indexes (if such
a thing exists). Any ideas how to go about this?


You could execute the output of a query like this (see "sysindexes " in Books
Online):

select 'drop index ' + object_name(id) + '.' + name
from sysindexes
where indid not in (0,255)
and name like object_name(id) + '[0-9]%'

Simon

I guess you are talking about Hypothetical Indexes.
Here is the script to drop the hypothetical indexes.

DECLARE @strSQL nvarchar(1024)
DECLARE @objid int
DECLARE @indid tinyint
DECLARE ITW_Stats CURSOR FOR SELECT id, indid FROM sysindexes WHERE
name LIKE 'hind_%' ORDER BY name
OPEN ITW_Stats
FETCH NEXT FROM ITW_Stats INTO @objid, @indid
WHILE (@@FETCH_STATUS <> -1)
BEGIN
SELECT @strSQL = (SELECT case when INDEXPROPERTY(i .id, i.name,
'IsStatistics') = 1 then 'drop statistics [' else 'drop index [' end +
OBJECT_NAME(i.i d) + '].[' + i.name + ']'
FROM sysindexes i join sysobjects o on i.id = o.id
WHERE i.id = @objid and i.indid = @indid AND
(INDEXPROPERTY( i.id, i.name, 'IsHypothetical ') = 1 OR
(INDEXPROPERTY( i.id, i.name, 'IsStatistics') = 1 AND
INDEXPROPERTY(i .id, i.name, 'IsAutoStatisti cs') = 0)))
EXEC(@strSQL)
FETCH NEXT FROM ITW_Stats INTO @objid, @indid
END
CLOSE ITW_Stats
DEALLOCATE ITW_Stats

Thank you
Raju
Jul 20 '05 #3
Simon Hayes wrote:
You could execute the output of a query like this (see "sysindexes " in Books
Online):

select 'drop index ' + object_name(id) + '.' + name
from sysindexes
where indid not in (0,255)
and name like object_name(id) + '[0-9]%'

Simon


Excellent. Thank you.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2899
by: Maryam | last post by:
Hi, I am having problems getting anything useful out of the index tuning wizard. I have created a table and inserted data into it. When i run the index tuning wizard i expect 2 indexes to be recommended so the book says (Index011 with a key on the uniqueid column and a non clustered index named table02 with a key on the col03 and LongCol02) Instead i get nothing being recommended.
0
1273
by: NathanG | last post by:
Hi, I've run the (SQL2K) Index Tuning Wizard against our 50GB database and it has recommended changes that will produce a "-3506%" improvement iin performance. The recommendations include a lot of indexes to be dropped and a few new ones to be created, in the Analysis - Query Cost Report screen all of the indexes shown have a zero or negative percent improvement (e.g. -96133%).
2
1622
by: SAP BASIS Consultant | last post by:
Hello, I have worked with Oracle and SAP over a number of years. I worked a bit with DB2 and SAP, and I am expecting to do so in the future. I am looking for a good book on tuning (For both OLTP and DSS, hopefully for both Windows and Unix) UDB v8.x. My preference is for a book containing mnay examples (i.e. This report took X minutes. We took steps X and Y and improved it, etc..)
2
1603
by: Ed L. | last post by:
The planner is choosing a sequential scan for my query. I am trying to understand why since it is clearly not the fastest choice, and what the proper tuning dial is to adjust here. Here's the query: select count(1) from measurement where measure_id = 98; TIA. Here are the details: % psql -c "\d measurement" Table "public.measurement"
2
1598
by: rAinDeEr | last post by:
Hi, I have a table with the following definition. The primary key is west_nme and west_eff_tms and i have created unique index on them. The foreign keys which reference other parent tables are west_typ_cde,r_cde,ccl_cde and t_cde and I have created indexes FK_t_west01,FK_t_west02,FK_t_west03 respectively. Now, all the other fields in this table participate in the WHERE clause
0
1156
by: uzi | last post by:
Hi Does someone know how to embed the audio and video tuning wizard into an application? I have noticed that the same component is used by messenger and Microsoft one note.
0
20321
by: Medhatithi | last post by:
Hi, I have been in several ways benefiited from this site. I would like to share some sql tuning techniques(simple, but effective) with you all. SQL Tuning Tips Oracle Tips Session #6 3/31/98 Kathy Gleeson ________________________________________
4
3080
by: Tommy Hayes | last post by:
Hello all, I want to use the SQL Server 2005 Tuning Advisor on our database, and I'm hoping someone here can just confirm the steps for me. We have a 10GB database that has a number of applications hitting it constantly, all performing many SELECTs, INSERTs and UPDATEs. Are the following the steps I need to take? 1. Stop all the applications hitting the database. 2. Make a backup of the database.
3
2257
by: Sam Durai | last post by:
A simple update involving two small tables takes 45 minutes to complete. I would appreciate if you can kindly help me to understand the root cause of this slowness. Users would be happy if I can bring the timing down to 5 minutes or less. Environment: DB2 V8.1 FP 12 / AIX 5.3 Both are non-partitioned tables..residing on a logically partitioned database
0
7951
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8439
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5966
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5465
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1553
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1296
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.