Word: Query Anxiety
Definition: The feeling you get in your gut when you are running a query and also dumping it and you realize you screwed up the SQL and your about to get about 10000 records displayed on screen.
Not that I've ever done that. Really. Pardon me while I shut down/restart Firefox and get back a few gigs of RAM.
Archived Comments
Or when you are developing code that uses a SQL delete and you run the page and it takes WAY longer then it should. Then you really wish you had setup a development SQL server intead of testing the code on the production database.
Rule #1 for dumping queries with debugging purposes... use TOP attribute.
I learned this lesson when debugging reports :)
So what.. It is your development server and you are the ONLY one on it!
Ah, the old Cartesian product. Don't you just love it?
Or when you forget the WHERE clause in DELETE * from....
I usually try to run the queries in a query analyzer before running them in CF... isql has a stop button that comes in rather handy sometimes. :)
updating an advertiser's phone number without the 'where' clause on a very popular classified site... thats one hot number for the evening...
my favorite SQL tip for testing queries is to surround all SQL within a transaction in query analyzer.
EX:
BEGIN TRAN
DELETE....
SELECT.... (this to see that my previous delete did what I thought it should)
ROLLBACK TRAN
Once I am happy with the results I can just change the ROLLBACK TRAN to a COMMIT TRAN.
@Tom K,
LOL! yeah that happened to me once on a production system when I was an inexperienced programmer... I Deleted all the orders from the system... then scrambled for the half hour restoring the database (fortunately I had a good back up plan in place and we only lost a few minutes worth of orders). There's a lesson you only want to learn once. Now I always verify any manually written delete statements with a select statement first, then change the "select *" to "Delete" once I'm satisfied I am deleting the right records. Even still I usually feel some "query anxiety" where I flash backs of my 1 and only mistake in that area, and knock on the wood of my desk before I click "execute" =)
i once ran a delete on a really big (data warehouse) table. after a few minutes i thought something was up. then i realized the where clause was incorrect. hit stop and waited for a few more minutes... fortunately the conditions were so off it was only doing a table scan, but nothing got deleted.
Or when you are developing code that uses a SQL , and testing a mail form, and you have 100000 emails in your box!
Back in CF4 days, I did this:
select email from users, agencies
cfmail to:#email# ......
ouch. >50K emails. my bad!
Fortunately I made a SECOND error and accidentally sent all of them to myself....
yeah.