Professional Web Applications Themes

Avoiding large queries... - Microsoft SQL / MS SQL Server

Hi, We are writing an ad hoc query tool for our users and we want to be able to warn them when the query they are about to run will either take a long-time (some rough time estimate) or return a large number of rows (approx). We connect to a SQL Server database using OLE DB / C++. Is there a good way to get rough estimates -- sufficient for us to say "The query you are about to execute may take a long time. Continue?"... thanks Chris...

  1. #1

    Default Avoiding large queries...

    Hi,

    We are writing an ad hoc query tool for our users and we want to be
    able to warn them when the query they are about to run will either
    take a long-time (some rough time estimate) or return a large number
    of rows (approx). We connect to a SQL Server database using OLE DB /
    C++. Is there a good way to get rough estimates -- sufficient for us
    to say "The query you are about to execute may take a long time.
    Continue?"...

    thanks
    Chris
    Christopher Stolte Guest

  2. #2

    Default Re: Avoiding large queries...

    You could use
    set showplan_all to get the estimated cost.
    If you execute it with another query of known cost then you can just
    compare the costs of the two queries to return a relative value.

    "rough estimates" and "may take a long time" imply that you realise you
    will never get a totally reliable answer.

    Nigel Rivett (SQL Server MVP)
    [url]www.nigelrivett.net[/url]

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Nigel Rivett Guest

Similar Threads

  1. query of queries and large data types
    By jim1234 in forum Coldfusion Database Access
    Replies: 1
    Last Post: May 12th, 06:38 PM
  2. Queries Of Queries Single Quote Problem
    By TimH2O in forum Macromedia ColdFusion
    Replies: 0
    Last Post: April 1st, 07:46 PM
  3. DBD::Pg behavior for large queries
    By Chris in forum PostgreSQL / PGSQL
    Replies: 1
    Last Post: January 19th, 11:33 AM
  4. Replies: 2
    Last Post: June 1st, 03:43 AM
  5. mod_perl - CGI params are undef on large queries
    By Martin Glaude in forum PERL Miscellaneous
    Replies: 0
    Last Post: August 9th, 02:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139