Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

slow insert, logical fragmentation
We had a table that had logical fragmentation of 50%.  After rebuilding
(with default fillfactor 0) I noticed that inserts are much faster.  If
my page density is 100% wouldn't I get more page splits?  I know I am
missing something fundamental here.  Could someone get me back on
track?

Table Size 1.5 million
Insert Size 70K

Before: 15 minutes
After: 3 minutes

Index:
Compound clustered across varchar columns
There are also a couple non-clustered indexes


Report this thread to moderator Post Follow-up to this message
Old Post
Dave
03-23-06 06:31 PM


Re: slow insert, logical fragmentation
A page split will occur when you insert contigeous data between already
existing data, if your pages are already full. However if you are
inserting new records (under a new date) then I dont see any page split
happening.


Report this thread to moderator Post Follow-up to this message
Old Post
zomer
03-23-06 06:31 PM


Re: slow insert, logical fragmentation
Dave (daveg.01@gmail.com)  writes:
> We had a table that had logical fragmentation of 50%.  After rebuilding
> (with default fillfactor 0) I noticed that inserts are much faster.  If
> my page density is 100% wouldn't I get more page splits?  I know I am
> missing something fundamental here.  Could someone get me back on
> track?

It depends on what your clustered index is on. If it is on a column that
is monotonically increasing, for instance an IDENTITY column or a
datetime column with the default of getdate(), then will be few splits,
because all new data goes into new pages.

But if the data inserted appears more random over your clustered index,
you will get more page splits, and your table will start to fragment
again.

In this case, if may be better to reindex to a lower fill factor than
100%, to create space for new rows in advance.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
03-24-06 01:34 AM


Re: slow insert, logical fragmentation
The clustered is a compound index on email varchar(100) and a guid.  I
can tune the indexes.  I was just wondering why the inserts were faster
after I defragmented the index?  It doesn't make sense to me.


Report this thread to moderator Post Follow-up to this message
Old Post
Dave
03-24-06 02:31 PM


Re: slow insert, logical fragmentation
try making no clustered index on the table.


Report this thread to moderator Post Follow-up to this message
Old Post
Doug
03-24-06 04:34 PM


Re: slow insert, logical fragmentation
Are you absolutely certain that the pages were 100% full after the index reb
uild? Remember that 0%
in DBCC DBREINDEXD mean that you reapply the fillfactor value you specified 
when creating the index
(sysindexes.origfillfactor). Or perhaps the rebuild of the clustered index a
lso rebuild a bunch of
non-clustered index leading to this effect. But I agree that it does sound a
 bit strange. Or perhaps
you had such low page density so you got a bunch of physical I/O before the 
rebuild (the data didn't
fit in cache), but after rebuild, the data *did* fit in cache so the executi
on resulted in
significantly less I/O?

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/
Blog: http:// solidqualitylearning
.com/blogs/tibor/


"Dave" <daveg.01@gmail.com> wrote in message
news:1143214113.493719.50500@v46g2000cwv.googlegroups.com...
> The clustered is a compound index on email varchar(100) and a guid.  I
> can tune the indexes.  I was just wondering why the inserts were faster
> after I defragmented the index?  It doesn't make sense to me.
>


Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
03-25-06 01:25 AM


Re: slow insert, logical fragmentation
Doug  (drmiller100@hotmail
.com)  writes:
> try making no clustered index on the table.

Bad idea. Unless there is proof of the opposite, always have a clustered
index on a table. At least it makes defragmentation easier. Heaps are also
more prone to fragmentation.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
03-25-06 01:25 AM


Re: slow insert, logical fragmentation
hmmm.
"always have a clustered index"?????

Why?  IMO, clustered indexes are a bad idea for most tables.


Report this thread to moderator Post Follow-up to this message
Old Post
Doug
03-25-06 04:28 PM


Re: slow insert, logical fragmentation
Doug  (drmiller100@hotmail
.com)  writes:
> hmmm.
> "always have a clustered index"?????
>
> Why?  IMO, clustered indexes are a bad idea for most tables.

Arguments? Or is it just an opinion?

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
03-25-06 06:29 PM


Re: slow insert, logical fragmentation
Erland Sommarskog a écrit :
> Doug  (drmiller100@hotmail
.com) writes: 
>
> Arguments? Or is it just an opinion?
>
take a look over Kimberly's paper about that.
You will see that CLUSTERED index is good for :
- monotonically growing index value
- monocolumn index
- no update to vartype data

A +


--
Frédéric BROUARD, MVP SQL Server, expert bases de données et langage SQL
Le site sur le langage SQL et les SGBDR  :  http://sqlpro.developpez.com
Audit, conseil, expertise, formation, modélisation, tuning, optimisation
 ********************
* http://www.datasapiens.com  ********************
***

Report this thread to moderator Post Follow-up to this message
Old Post
SQLpro [MVP]
03-27-06 12:37 PM


Sponsored Links





Last Thread Next Thread
Pages (2): [1] 2 »
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 10:38 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006