Access sometimes won't use index of linked view



Hello,

I have a weird problem with sql server 2000. I have a view wich
combines 2 tables like this:

SELECT foo
FROM dbo.tblA LEFT OUTER JOIN
dbo.tblB ON dbo.A.ID = dbo.B.ID

Table B contains a field named fldSorting, wich has an index. It is
used - you have already guessed it by now :) - for sorting.

The view, linked with odbc, is the datasource on a form in ms access
like this: SELECT * FROM foo ORDER BY fldSorting;
This does work. However, for some weird reason, this view becomes
very, VERY slow from time to time (> 1 minute). This happens once in
three months or something. I have looked with the profiler what
exactly access is querying, and that is just normal: SELECT * FROM foo
ORDER BY fldSorting. If i execute this in the query analyzer, it is as
fast as always (<2 seconds)! This is extremely weird, right?
I have found a way to make it quick again, but only for a couple of
months: remove the index on field fldSorting and create it again.

How comes? I have absolutely no clue whatsoever.
1. Why does this problem pop up sometimes?
2. Why does sometimes the exact same query seems to not use an index
if access executes it via odbc, while executed via the query analyzer,
all is ok?

This is a very unpleasant problem since it is our main sql server, and
our ERP system is also running on this server. So every time this
happens, everybody has a break....

Does anybody has some ideas? I will be very happy with all thoughts...

Thanks in advance,

B. Lowsma
Netherlands

.



Relevant Pages

  • Re: Access sometimes wont use index of linked view
    ... SELECT foo ... Table B contains a field named fldSorting, ... If i execute this in the query analyzer, ...
    (microsoft.public.sqlserver.clients)
  • Re: Help needed with a SELECT statement
    ... INSERT INTO Foo VALUES ... ORDER BY mydate ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: SQL Express - Identity specification property - how to change
    ... DELETE FROM Foo ... Why should that by necessity be a no-op? ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Help needed with a SELECT statement
    ... mytextdate to your SELECT statement gives this error:- ... INSERT INTO Foo VALUES ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Deleting Fields
    ... > sp_help #foo ... >> If I delete a field in SQL Server, will all constraints, foreign keys, ...
    (microsoft.public.sqlserver.server)

Loading