Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Query
Message
De
31/03/1999 15:39:38
Bob Lucas
The WordWare Agency
Alberta, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Divers
Thread ID:
00203888
Message ID:
00204025
Vues:
17
>I have a SQL Server 6.5 query that is based on a date range. For example, if I put in 03/01/1999 and 03/15/1999 I get results quickly. If I put in 03/01/1999 and 03/31/1999 it takes a very long time. Any ideas?
>
>The code:
>
>SELECT id, first, middle, last, type, expdt, fromdt, thrudt, 9999.99 as dues, 999 as instal, 9999 as months from master where group = 'Member' and delet <> 1 and exprdt >= m.expdt1 and expdt <= expdt2 and id not in (select dueid from dues where period = ?m.period or (duetype = 'LIFE' and thrudt = '12/31/9999')) order by last

SQL Server may be employing a table lock because of the larger date range and because of the number of pages required to fulfil the query.

You could try a couple of things. Use a clustered index for expdt. It could be a problem with statistics that are used by the query optimizer. Try updating statistics. You might even try rearranging your where clause. try putting the conditions that have the fewest records at the beginning.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform