Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does Properties work?
Message
 
 
À
04/12/2006 09:15:21
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00838308
Message ID:
01456334
Vues:
62
Please see this link for fast row count in SQL Server

http://sqlblogcasts.com/blogs/simons/archive/2010/01/14/Quickest-way-to-get-the-row-count-of-a-table.aspx

>Thanks Sergey,
>
>thought I was going crazy!
>
>>>I have an SQL 2000 table that the Properties shows 1990 rows, but in the Open all it appears to have 2000 and if I use a Foxpro remote view, it shows 2000 records.
>>>
>>Hi Joel,
>>
>>There're two ways to get total records count in SQL Server table:
>>1. SELECT COUNT(*) FROM mytable
>>Produces correct count but may take long on tables with a lot of records.
>>
>>2. SELECT rowcnt FROM sysindexes WHERE id=OBJECT_ID('dbo.mytable') and indid < 2
>>Fast but result isn't relaible because it's based on data stored in sysindexes tables which may or may not be current.
>>
>>Most likely SQL Server uses the second method because it's much faster on big tables.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform