473,394 Members | 1,302 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,394 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 4324
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.