Turning off default PK Clustered index


Author
Message
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I see that my new best friend - the DDT - creates PK indexes as clustered.



Is there a good way to turn this off, either globally ( in source code ? ) or perhaps there is something I'm missing in the current interface ( writing this before installing 1.61 so if it's there already just point me to it )



I use a lot of UID PKs in tables I am converting from VFP and my understanding is a clustered index isn't a good idea.



TIA



Charles
Replies
Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Found it, clustered indexes are bad for GUID's, like you said because they take too long to build.



Learn something every day.

Keith Chisarik
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The problem with clustered indexes in a GUID field are that the GUIDs are random, so when a new record is inserted, a significant portion of the data on disk has to be moved to insert the records into the middle of the table.  However, with integer-based clustered indexes, the integers are normally sequential (like with an IDENTITY spec), so they just get added to the end an no data needs to be moved around.

Now, that being said... clustered indexes are not always bad on GUIDs... it all depends upon the needs of your application.  If you need to be able to SELECT records quickly, then use a clustered index... the INSERT speed will suffer, but the SELECT speed will be improved.  But, if you insert a bunch of records and don't use them much after that... like in a log file or something, then don't use a clustered index on a GUID field, because you care more about your INSERT speed than your SELECT speed.

Or at least that's what I've always understood from what I've read on clustered indexes Smile

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Charles R Hankey - 18 Years Ago
Charles R Hankey - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Keith Chisarik - 18 Years Ago
Keith Chisarik - 18 Years Ago
StrataFrame Team - 18 Years Ago
Charles R Hankey - 18 Years Ago
StrataFrame Team - 18 Years Ago
Charles R Hankey - 18 Years Ago
Paul Chase - 18 Years Ago
StrataFrame Team - 18 Years Ago
Paul Chase - 18 Years Ago
Charles R Hankey - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search