Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 517651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:51:22+00:00 2026-05-13T07:51:22+00:00

Let’s say we have a [Valuations] table containing several values per date and per

  • 0

Let’s say we have a [Valuations] table containing several values per date and per fund:
-FundId
-ValDate
-Value1
-Value2…

The Primary key is obviously FundId+ValDate.
I have also indexed the ValDate field since I often query for values on a specific date.

My question is: should I also create a specific index for the FundId, or is MsAccess clever enough to use the Primary key when querying on a specific FundId ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:51:22+00:00Added an answer on May 13, 2026 at 7:51 am

    The Primary key is obviously
    FundId+ValDate

    In which order? And how do you access your data?

    The Access Database Engine uses the PRIMARY KEY as the clustered index. If you did this

    PRIMARY KEY (FundId, ValDate)

    then you will get a different order on disk than if you did this

    PRIMARY KEY (ValDate, FundId)

    To show the order of the columns in the PK when using the Access GUI (in case you didn’t use SQL DDL to create the PRIMARY KEY): in table design view, click the Indexes button, or enable Indexes in the View menu. The list will show all indexes, and for multiple fields ones, it shows the order, which you can alter.

    The order of columns in the clustered index is important because it defines the one and only physical index for the table, your uber index as it were.

    (ValDate, FundId) will favour BETWEEN (or equivalent) predicates or GROUP BY on ValDate e.g. date range queries returning multiple funds.

    (FundId, ValDate) former may favour fund specific queries … or may encourage page locks, depending on how the values are generated….

    You should by now be getting the impression that with performance issues is there are many variables involved: how the PK was defined, the generation of the key values, how often you compact the file, your locking strategy (e.g. page level or row level?), high or low activity environment, etc. Not to mention the nature of the queries you run against the table (e.g. by date or by key?)

    are you sure Access supports clustered
    indexes ?

    Sure and here are some salient articles on MSDN:

    New Features in Microsoft Jet Version 3.0
    “Compacting the database now results in the indices being stored in a clustered-index format. While the clustered index isn’t maintained until the next compact, performance is still improved. This differs from Microsoft Jet 2.x where rows of data were stored the way they were entered. The new clustered-key compact method is based on the primary key of the table. New data entered will be in time order.”

    Defragment and compact database to improve performance in Microsoft Access
    “If a primary key exists in the table, compacting restores table records into their primary key order. This provides the equivalent of Non-maintained Clustered Indexes, and makes the read-ahead capabilities of the Microsoft Jet database engine much more efficient… Query speed will be enhanced significantly, because they are now working with data that has been rewritten to the tables in contiguous pages. Scanning sequential pages is much faster than scanning fragmented pages.”

    How To Optimize Queries in Visual Basic
    “This article assumes that you are using the Microsoft Jet database engine… As your database grows, it will become fragmented. Compacting writes all the data in a table into contiguous pages on the hard disk, improving performance of sequential scans.”

    Information about query performance in an Access database
    “When you compact your database you can speed up queries. When you compact your database, the records of the table are reorganized so that the records reside in adjacent database pages that are ordered by the primary key of the table. This improves the performance of the sequential scans of records in the table because only the minimum number of database pages now have to be read to retrieve the records that you want.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 379k
  • Answers 379k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Ok, so after all the help from Barry, I had… May 14, 2026 at 9:32 pm
  • Editorial Team
    Editorial Team added an answer Without further details I would assume that this task is… May 14, 2026 at 9:32 pm
  • Editorial Team
    Editorial Team added an answer Bypassing the printer driver and controlling the printer directly, using… May 14, 2026 at 9:32 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.