Row count

George PalaceanGeorge Palacean Posts: 28
edited March 25, 2009 6:27AM in SQL Doc Previous Versions
I noticed that to get the number of rows in a table, SQL Doc runs select count_big (*) from table_name; but that's very slow for large tables and puts huge load on the database, not talking about locking (I think that's the reason it stops after 30 seconds or so...).

Instead, is it possible to take them from the sys.dm_db_partition_stats view (at least for SQL Server 2005 and 2008)? That's how Microsoft's sp_spaceused procedure works, and it's instantaneous.

It would also be very good to have the number of rows for each table on the 'Tables' page (where the list of all tables in the database is), together with their size and/or other info - the page looks too empty and useless now.

Thanks,
George

Comments

  • The only thing I would say about including row count value on the tables page is that this information should be optional on the tables list (and the table page for that matter ) - like the SQL Script option.

    The reason for this is that some users of SQL Doc are using your product to document databases that have many production instances (e.g. a database that's part of a product rather than in-house database). In these situations rowcount is not relevant (and the documentation is usually generated on non-production databases anyway - so the rowcount is of test or dev data.)

    Totally agree about not using count_big(*) for the rowcount. Then again I don't run SQL Doc against a production database.

    Thanks,

    Alex
    Alex Weatherall
    TeleWare.com
  • The ability to turn off the row count altogether or modify how it is calculated has already bene logged as a feature request in our tracking system and will be considered for the next release of SQL Doc although we have no timescales for this at present.
Sign In or Register to comment.