 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Luna Guest
|
Posted: Fri May 14, 2004 12:00 am Post subject: Cancel a Query, how to |
|
|
My MS Sql database is over a terribyte.
Sometimes a user want to cancel a query (some can take a few minutes) when a
user makes a mistatke in their request, they must wait unitll the incorrect
querry runs it's course. (select queries only, no updates or inserts or
deletes)
How can I have the user cancel the query
I belive I have to use a thread.
I plan to have a form with a cancel button pop up and disable the calling
form untill the query is complete or cancel.
I have to get data from the results to the calling form.
D7, SQL 2000
Thanks in Advance
|
|
| Back to top |
|
 |
Del Murray Guest
|
Posted: Fri May 14, 2004 1:23 am Post subject: Re: Cancel a Query, how to |
|
|
AFAIK there is no way to cancel a query, once you turn it loose to the
database engine, it is out of your control. The best thing is to tune the
queries and the database so that queries run very very fast. You would be
surprised at the mistakes folks make configuring a SQL server database .
Indexes that dont get used, clustering index when it should not be done, no
covering index or using a covering index when it's wrong, parameters that
drive sql server nuts, I saw one last week where the programmers had been
messing with the server for 18 months trying to get a 4 CPU 4GIG machine to
run queries faster. They had set Max Memory to 1.2 Gig and didn't realize
what they had done. the other 3 gig were not being used. There are a ton of
things you might be able to do so that the 2 or 4 minutes query really runs
in 6 or 18 seconds which means it doesn't have to get canceled.
|
|
| Back to top |
|
 |
Craig van Nieuwkerk Guest
|
Posted: Fri May 14, 2004 3:07 am Post subject: Re: Cancel a Query, how to |
|
|
"KILL pid" will kill a process in SQLServer. You can see processes with
sp_who.
| Quote: | AFAIK there is no way to cancel a query, once you turn it loose to the
database engine, it is out of your control. The best thing is to tune the
queries and the database so that queries run very very fast. You would be
surprised at the mistakes folks make configuring a SQL server database .
Indexes that dont get used, clustering index when it should not be done,
no
covering index or using a covering index when it's wrong, parameters that
drive sql server nuts, I saw one last week where the programmers had been
messing with the server for 18 months trying to get a 4 CPU 4GIG machine
to
run queries faster. They had set Max Memory to 1.2 Gig and didn't realize
what they had done. the other 3 gig were not being used. There are a ton
of
things you might be able to do so that the 2 or 4 minutes query really
runs
in 6 or 18 seconds which means it doesn't have to get canceled.
|
|
|
| Back to top |
|
 |
Michael Luna Guest
|
Posted: Fri May 14, 2004 8:39 pm Post subject: Re: Cancel a Query, how to |
|
|
The system is optimized to the best we know how
"Del Murray" <Del.Murray (AT) N_S_CreditHawk (DOT) Net> wrote
| Quote: | AFAIK there is no way to cancel a query, once you turn it loose to the
database engine, it is out of your control. The best thing is to tune the
queries and the database so that queries run very very fast. You would be
surprised at the mistakes folks make configuring a SQL server database .
Indexes that dont get used, clustering index when it should not be done,
no
covering index or using a covering index when it's wrong, parameters that
drive sql server nuts, I saw one last week where the programmers had been
messing with the server for 18 months trying to get a 4 CPU 4GIG machine
to
run queries faster. They had set Max Memory to 1.2 Gig and didn't realize
what they had done. the other 3 gig were not being used. There are a ton
of
things you might be able to do so that the 2 or 4 minutes query really
runs
in 6 or 18 seconds which means it doesn't have to get canceled.
|
|
|
| Back to top |
|
 |
Michael Luna Guest
|
Posted: Fri May 14, 2004 8:44 pm Post subject: Re: Cancel a Query, how to |
|
|
I need help in setting this up with mulit threading so the user can cancel.
"Craig van Nieuwkerk" <craigvn (AT) dart (DOT) net.au> wrote
| Quote: | "KILL pid" will kill a process in SQLServer. You can see processes with
sp_who.
AFAIK there is no way to cancel a query, once you turn it loose to the
database engine, it is out of your control. The best thing is to tune
the
queries and the database so that queries run very very fast. You would
be
surprised at the mistakes folks make configuring a SQL server database .
Indexes that dont get used, clustering index when it should not be done,
no
covering index or using a covering index when it's wrong, parameters
that
drive sql server nuts, I saw one last week where the programmers had
been
messing with the server for 18 months trying to get a 4 CPU 4GIG machine
to
run queries faster. They had set Max Memory to 1.2 Gig and didn't
realize
what they had done. the other 3 gig were not being used. There are a ton
of
things you might be able to do so that the 2 or 4 minutes query really
runs
in 6 or 18 seconds which means it doesn't have to get canceled.
|
|
|
| Back to top |
|
 |
Michael Luna Guest
|
Posted: Fri May 14, 2004 9:14 pm Post subject: Re: Cancel a Query, how to |
|
|
Now that I thnik about it. I don't need to cancel the query, Just release
the the thread the called the query. So the Delphi App can continue on to
other task, manily the user redifining his query.
"Del Murray" <Del.Murray (AT) N_S_CreditHawk (DOT) Net> wrote
| Quote: | AFAIK there is no way to cancel a query, once you turn it loose to the
database engine, it is out of your control. The best thing is to tune the
queries and the database so that queries run very very fast. You would be
surprised at the mistakes folks make configuring a SQL server database .
Indexes that dont get used, clustering index when it should not be done,
no
covering index or using a covering index when it's wrong, parameters that
drive sql server nuts, I saw one last week where the programmers had been
messing with the server for 18 months trying to get a 4 CPU 4GIG machine
to
run queries faster. They had set Max Memory to 1.2 Gig and didn't realize
what they had done. the other 3 gig were not being used. There are a ton
of
things you might be able to do so that the 2 or 4 minutes query really
runs
in 6 or 18 seconds which means it doesn't have to get canceled.
|
|
|
| Back to top |
|
 |
Ray Guest
|
Posted: Fri May 28, 2004 11:24 am Post subject: Re: Cancel a Query, how to |
|
|
You can cancel a query if you set the query to run asynchronously in ADO.
However, that itself introduces a whole new set of complications, especially
in dealing with the result set when it comes back.
--
Peter Yeoh
http://www.yohz.com
Need smaller backup files? Try MiniSQLBackup
"Michael Luna" <michael (AT) winvotes (DOT) com> wrote
| Quote: | Now that I thnik about it. I don't need to cancel the query, Just release
the the thread the called the query. So the Delphi App can continue on to
other task, manily the user redifining his query.
"Del Murray" <Del.Murray (AT) N_S_CreditHawk (DOT) Net> wrote in message
news:40a41ec7$1 (AT) newsgroups (DOT) borland.com...
AFAIK there is no way to cancel a query, once you turn it loose to the
database engine, it is out of your control. The best thing is to tune
the
queries and the database so that queries run very very fast. You would
be
surprised at the mistakes folks make configuring a SQL server database .
Indexes that dont get used, clustering index when it should not be done,
no
covering index or using a covering index when it's wrong, parameters
that
drive sql server nuts, I saw one last week where the programmers had
been
messing with the server for 18 months trying to get a 4 CPU 4GIG machine
to
run queries faster. They had set Max Memory to 1.2 Gig and didn't
realize
what they had done. the other 3 gig were not being used. There are a ton
of
things you might be able to do so that the 2 or 4 minutes query really
runs
in 6 or 18 seconds which means it doesn't have to get canceled.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|