BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cancel a Query, how to

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Michael Luna
Guest





PostPosted: Fri May 14, 2004 12:00 am    Post subject: Cancel a Query, how to Reply with quote



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





PostPosted: Fri May 14, 2004 1:23 am    Post subject: Re: Cancel a Query, how to Reply with 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
Craig van Nieuwkerk
Guest





PostPosted: Fri May 14, 2004 3:07 am    Post subject: Re: Cancel a Query, how to Reply with quote



"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





PostPosted: Fri May 14, 2004 8:39 pm    Post subject: Re: Cancel a Query, how to Reply with quote

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





PostPosted: Fri May 14, 2004 8:44 pm    Post subject: Re: Cancel a Query, how to Reply with quote

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





PostPosted: Fri May 14, 2004 9:14 pm    Post subject: Re: Cancel a Query, how to Reply with 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

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





PostPosted: Fri May 28, 2004 11:24 am    Post subject: Re: Cancel a Query, how to Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.