Re: sp_fkeys stored procedue is very slow



(keyvez@xxxxxxxxx) writes:
I am trying to find the tables and columns that depends on 'table1'

sp_fkeys @pktable_name='table1'

and this takes about eight seconds, whereas if I run it for finding all
tables and columns that 'table1' depends on

sp_fkeys @fktable_name='table1'

this only takes a second.

How can I speed up the first stored procedure execution?

Are there many tables in the database?

I'm afraid there is not that much you could do. You could of course
script the database from the master database, and play around with a
copy of the procedure, to see if you can make it go faster. One idea
there would be to replace the temp tables with table variables. Tracing
the procedure in Profile would of course also be necessary to see where
the time is spent.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: How to protect SQL Server Express database from reverse engineerin
    ... prevent anyone from reverse engineering our database. ... I say within reasonable limits, ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.security)
  • Re: Problem with my SQL 2000 Maintenance plans.
    ... I wouldn't use maint plan for this. ... using the most recent update of Books Online). ... If you do have a problem in the database, you want to be alerted so you can do ... >> option will most probably be removed in next version of SQL Server. ...
    (microsoft.public.sqlserver.server)
  • Re: Setting Up SQL Security
    ... want that user to have complete access to a database. ... But if it's impedient that no information whatsoever is ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.security)
  • Re: how to create database
    ... ' Connection string, change server and database! ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.data.oledb)
  • Re: Is it possible to cascade table and field name changes to views
    ... select id from table1 ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)