473,382 Members | 1,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Clustered Indexes

'Property Clustered As Boolean
'Member of DAO.Index

Private Sub IsThereaClusteredIndex()
Dim tdf As DAO.TableDef
Dim idx As DAO.Index
For Each tdf In DBEngine(0)(0).TableDefs
For Each idx In tdf.Indexes
Debug.Print tdf.Name, idx.Name, idx.Primary, idx.Clustered
Next idx
Next tdf
End Sub

(For Jet), under what conditions will idx.Clustered be true?

--
Lyle Fairfield
Aug 2 '06 #1
2 4321
On Wed, 02 Aug 2006 01:59:48 GMT, Lyle Fairfield
<ly***********@aim.comwrote:

Put this code at the top of your procedure:

Set tdf = DBEngine(0)(0).TableDefs("Customers")
Set idx = tdf.CreateIndex("testClustered")
With idx
.Clustered = True
.Fields.Append .CreateField("CustomerID")
End With
tdf.Indexes.Append idx

-Tom.
>'Property Clustered As Boolean
'Member of DAO.Index

Private Sub IsThereaClusteredIndex()
Dim tdf As DAO.TableDef
Dim idx As DAO.Index
For Each tdf In DBEngine(0)(0).TableDefs
For Each idx In tdf.Indexes
Debug.Print tdf.Name, idx.Name, idx.Primary, idx.Clustered
Next idx
Next tdf
End Sub

(For Jet), under what conditions will idx.Clustered be true?
Aug 2 '06 #2
From my 97 help (The Access 2000 help is broken again)

---------
Some IISAM desktop database formats use clustered indexes.

· Microsoft Jet databases ignore the Clustered property because the
Microsoft Jet database engine doesn't support clustered indexes.
· For ODBC data sources the Clustered property always returns False; it does
not detect whether or not the ODBC data source has a clustered index.
----------

A clustered index is one where the physical order of the data matches the
index order. You do this so that when you want related records, they are
physically close to each other: 'clustered', (or to spread related records
if you are using page locking) To help achieve this, you pack the table with
free space, so that records can be entered into the correct position.

For those old ISAM databases, you wanted to specify the cluster index, and
you wanted to use the cluster index when walking through the table.

Actually, a Jet 3/4 primary key index is a kind of clustered index, but with
no free space, so the only way to correct the physical order to match the
index is to compact the database.

SQL Server allows you to specify the free space ratio, so that the clustered
data remains correctly clustered according to the cluster index as you add
new data. Also, SQL Server lets you specify separate primary key and cluster
indexes.

Access, as a relational database, didn't use clustered indexes. But in fact
there was still a physical order, so it is more correct to say just that
Access didn't allow you control the clustering. One of the changes between
Jet 1 and Jet 3 was to allow you to specify (the default) that the physical
record order would be the primary key index order. But records are still
added in time sequence, only re-ordered to primary key order on compact.
The mixed order after data entry is the reason 'first' and 'last' don't work
any more. (But actually, 'first' and 'last' don't work anyway because of
anomalies in the jet query compiler).

(david)
"Lyle Fairfield" <ly***********@aim.comwrote in message
news:Xn*********************************@216.221.8 1.119...
'Property Clustered As Boolean
'Member of DAO.Index

Private Sub IsThereaClusteredIndex()
Dim tdf As DAO.TableDef
Dim idx As DAO.Index
For Each tdf In DBEngine(0)(0).TableDefs
For Each idx In tdf.Indexes
Debug.Print tdf.Name, idx.Name, idx.Primary, idx.Clustered
Next idx
Next tdf
End Sub

(For Jet), under what conditions will idx.Clustered be true?

--
Lyle Fairfield

Aug 2 '06 #3

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

Similar topics

2
by: Chris | last post by:
Any help would be appreciated. I am running a script that does the following in succession. 1-Drop existing database and create new database 2-Defines tables, stored procedures and functions...
1
by: Steve_CA | last post by:
Hi, The more I read, the more confused I'm getting ! (no wonder they say ignorance is bliss) I just got back from the bookstore and was flipping through some SQL Server Administration...
5
by: jim_geissman | last post by:
One table I manage has a clustered index, and it includes some varchar columns. When it is initially created, all the columns in the clustered index are populated, and then some of the longer...
1
by: anonieko | last post by:
A lot of detailed discussion explains the difference between clustered and non-clustered indexes. But very few 'clarifies' why the term used is 'clustered'. Well, once and for all, this is my...
5
by: pb648174 | last post by:
I've been doing a bit of reading and have read in quite a few places that an identity column is a good clustered index and that all or at least most tables should have a clustered index. The tool I...
1
by: Curt | last post by:
What is the difference please?
1
by: atul123 | last post by:
what is clustered and non clustered index and their types
0
by: tz71 | last post by:
If a new filegroup is created on a new disk drive, is there a way to migrate a specific clustered index to the new filegroup? SQL Server 2005 SP2 kb
1
by: David Portas | last post by:
"Erland Sommarskog" <esquel@sommarskog.sewrote in message news:Xns9B5AD2ADD1265Yazorman@127.0.0.1... Erland, I'm sure you mean that to be with love and care, rather than just "slap on" any...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.