Why does adding indexes slow down queries?

S

Steeve Richard

I have a DB that performs aircraft maintenance data
analysis.

It runs dozens of very complex queries on roughly 700 000
records. I used the performance analyzer to determine
which fields were the best canditates for indexation. The
fields suggested made perfect sense because I did a lot of
joins and criteria on them.

Much to my surprize, after creating the suggested indexes,
the execution time of the queries nearly doubled, even
after a compact/repair operation.

What gives?

Steeve
 
D

david epsom dot com dot au

The query planner is not perfect. It may be that using
the index doubles the effort (first read the index, then
read the data), or, more likely, the query planner has
decided to use the indexes to join two large tables
(to reduce the record set by joining the two tables),
before applying some other criteria,
where before it was applying the criteria (to reduce the
recordset) before doing a small join without the indexes

Access does not give you direct control over the order
of processes in a complex query: the only thing you can
do is add/remove indexes and move the WHERE criteria
around in your sub-queries.

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top