PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > drop index will recreate an index.
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
drop index will recreate an index.

Réponse
 
LinkBack Outils de la discussion
Vieux 14/07/2008, 14h26   #1
tdr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut drop index will recreate an index.

I need to temporary drop indexes then truncate and reload data into a table.
when I run a drop index command on a table, it will drop the indexes and the
recreate an index.

I'm not sure want index it creates, there are no indexes listed on the table
when I look at the prosperities.
but I will see 'creating index' when I run sp_who while the drop command is
running.

I'm trying to speed up the process of reloading the table by not having
indexes.

I have 8 indexes (one is clustered)
what index would the sql be adding back and why?
Should I disable the index
Or should I truncate the table before dropping the indexes?

TIA
  Réponse avec citation
Vieux 14/07/2008, 14h33   #2
Uri Dimant
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: drop index will recreate an index.

tdr
Very strange, can you show us your code?



"tdr" <tdr@discussions.microsoft.com> wrote in message
news:3B43A8A2-1EA7-483B-B8E1-D9AE45B0E99F@microsoft.com...
>I need to temporary drop indexes then truncate and reload data into a
>table.
> when I run a drop index command on a table, it will drop the indexes and
> the
> recreate an index.
>
> I'm not sure want index it creates, there are no indexes listed on the
> table
> when I look at the prosperities.
> but I will see 'creating index' when I run sp_who while the drop command
> is
> running.
>
> I'm trying to speed up the process of reloading the table by not having
> indexes.
>
> I have 8 indexes (one is clustered)
> what index would the sql be adding back and why?
> Should I disable the index
> Or should I truncate the table before dropping the indexes?
>
> TIA



  Réponse avec citation
Vieux 14/07/2008, 14h42   #3
Dan Guzman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: drop index will recreate an index.

> I have 8 indexes (one is clustered)
> what index would the sql be adding back and why?


If you drop the clustered index before non-clustered indexes, SQL Server
will need to rebuild all of the remaining non-clustered indexes. This is
because non-clustered indexes use the clustered index key as the row locator
when the table has a clustered index. Non-clustered indexes use the
internal row id as the row locator when no clustered index ix present.

> Should I disable the index
> Or should I truncate the table before dropping the indexes?


As long as you drop/disable the non-clustered indexes first, I don't think
it matters much whether your truncate or drop first.

--
Hope this s.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"tdr" <tdr@discussions.microsoft.com> wrote in message
news:3B43A8A2-1EA7-483B-B8E1-D9AE45B0E99F@microsoft.com...
>I need to temporary drop indexes then truncate and reload data into a
>table.
> when I run a drop index command on a table, it will drop the indexes and
> the
> recreate an index.
>
> I'm not sure want index it creates, there are no indexes listed on the
> table
> when I look at the prosperities.
> but I will see 'creating index' when I run sp_who while the drop command
> is
> running.
>
> I'm trying to speed up the process of reloading the table by not having
> indexes.
>
> I have 8 indexes (one is clustered)
> what index would the sql be adding back and why?
> Should I disable the index
> Or should I truncate the table before dropping the indexes?
>
> TIA


  Réponse avec citation
Vieux 14/07/2008, 15h31   #4
tdr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: drop index will recreate an index.

so the drop command below

drop index LClaims.IX_LuminxClaims
drop index LClaims.tot_stats_tickler

should be ( drop non clustered first then clustered)

drop index LClaims.tot_stats_tickler
drop index LClaims.IX_LuminxClaims

Thanks, I try it.

"tdr" wrote:

> I need to temporary drop indexes then truncate and reload data into a table.
> when I run a drop index command on a table, it will drop the indexes and the
> recreate an index.
>
> I'm not sure want index it creates, there are no indexes listed on the table
> when I look at the prosperities.
> but I will see 'creating index' when I run sp_who while the drop command is
> running.
>
> I'm trying to speed up the process of reloading the table by not having
> indexes.
>
> I have 8 indexes (one is clustered)
> what index would the sql be adding back and why?
> Should I disable the index
> Or should I truncate the table before dropping the indexes?
>
> TIA

  Réponse avec citation
Vieux 14/07/2008, 15h38   #5
tdr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: drop index will recreate an index. _Building index?

does this rule apply to building index.
i.e. build cluster first and non-clustered last?

thanks again.

"tdr" wrote:

> I need to temporary drop indexes then truncate and reload data into a table.
> when I run a drop index command on a table, it will drop the indexes and the
> recreate an index.
>
> I'm not sure want index it creates, there are no indexes listed on the table
> when I look at the prosperities.
> but I will see 'creating index' when I run sp_who while the drop command is
> running.
>
> I'm trying to speed up the process of reloading the table by not having
> indexes.
>
> I have 8 indexes (one is clustered)
> what index would the sql be adding back and why?
> Should I disable the index
> Or should I truncate the table before dropping the indexes?
>
> TIA

  Réponse avec citation
Vieux 14/07/2008, 16h10   #6
Roy Harvey (SQL Server MVP)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: drop index will recreate an index. _Building index?

On Mon, 14 Jul 2008 06:38:03 -0700, tdr
<tdr@discussions.microsoft.com> wrote:

>does this rule apply to building index.
>i.e. build cluster first and non-clustered last?


Yes, absolutely.

Roy Harvey
Beacon Falls, CT
  Réponse avec citation
Vieux 14/07/2008, 17h52   #7
Tom Cooper
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: drop index will recreate an index. _Building index?

If you are not changing the schema of the tables, just deleting the old data
and reloading it with new data, you could experment whether or not it is
faster/better to keep the clustered index or drop it. So two possible
procedures are

Drop nonclustered indexes
Truncate Table
Drop clustered index
Reload table
Create clustered index
Create nonclustered indexes

or

Drop nonclustered indexes
Truncate Table
Reload table
Create nonclustered indexes

If you do the second method, make sure the rows are loaded in clustered
index order. If they are loaded out of order, you will get page splits and
that will slow things down.

Tom

"Roy Harvey (SQL Server MVP)" <roy_harvey@snet.net> wrote in message
news:pinm7419l2al3p6imufpu13dn8t1gjdp5k@4ax.com...
> On Mon, 14 Jul 2008 06:38:03 -0700, tdr
> <tdr@discussions.microsoft.com> wrote:
>
>>does this rule apply to building index.
>>i.e. build cluster first and non-clustered last?

>
> Yes, absolutely.
>
> Roy Harvey
> Beacon Falls, CT



  Réponse avec citation
Vieux 15/07/2008, 04h31   #8
Jeffrey Williams
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: drop index will recreate an index. _Building index?

Tom Cooper wrote:
> If you are not changing the schema of the tables, just deleting the old data
> and reloading it with new data, you could experment whether or not it is
> faster/better to keep the clustered index or drop it. So two possible
> procedures are
>
> Drop nonclustered indexes
> Truncate Table
> Drop clustered index
> Reload table
> Create clustered index
> Create nonclustered indexes
>
> or
>
> Drop nonclustered indexes
> Truncate Table
> Reload table
> Create nonclustered indexes
>
> If you do the second method, make sure the rows are loaded in clustered
> index order. If they are loaded out of order, you will get page splits and
> that will slow things down.
>
> Tom
>
> "Roy Harvey (SQL Server MVP)" <roy_harvey@snet.net> wrote in message
> news:pinm7419l2al3p6imufpu13dn8t1gjdp5k@4ax.com...
>> On Mon, 14 Jul 2008 06:38:03 -0700, tdr
>> <tdr@discussions.microsoft.com> wrote:
>>
>>> does this rule apply to building index.
>>> i.e. build cluster first and non-clustered last?

>> Yes, absolutely.
>>
>> Roy Harvey
>> Beacon Falls, CT

>
>


The OP did not state what version - but, if this is on 2005 I would
recommend disabling the non-clustered indexes instead of dropping them,
leave the clustered index, and after the data is loaded rebuild all
indexes (ALTER INDEX ALL ON table REBUILD

This will rebuild all indexes including the clustered index which will
take care of any page splits, if the table is not loaded in clustered
index order.

Jeff
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h05.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16317 seconds with 16 queries