Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2007, 03:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:The worst part is its possible pratically, but then in my knowledge SQL doesn't allow.
May be I am not getting that clear. What is possible practically that SQL doesn't allow?

What is the volume of data that you foresee to subject to this operation?
How frequently this Update/Delete is to be scheduled or done?
Do you have proper indexes in place to handle this?

Answers to these will give you the answer for the performance hit that you are worried about.

_________________________
- Vijay G
Strive for Perfection
 
Old May 3rd, 2007, 03:39 AM
Authorized User
 
Join Date: Apr 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Pratically its possible to do the operations which i have mentioned in another thread in single step.

Assume the patient is being discharged from the hospital, then in that case I will have to do two things
1 Update the refcount (decrement by 1).
2 If RefCount becomes 0 that entry should be deleted from the table.

Pratically,
 Assume its a BTree, We can search the binary tree with the given name and if the name is found (in this case surely gonna happen), we reduce the associated refcount value (decrement by 1), now at that time itself we can check whether its value has become zero, if yes we can delete that node in O(1) time. Whereas in SQL, even though for updating i reach the given node in the Btree, but then for delete i will again have to reach the given node.

The solution which you gave (delete first, check rowcount, update refcount) also faces this problem, while deleting i will have to search the tree with refcount = 1 and given name, if the refcount is not zero i will again have to search the tree with the given name to update the value of refcount.

I hope this will clear u, what i am expecting.

 
Old May 3rd, 2007, 06:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes it is clear, but any DML is going to be an independant transaction, where in you want to do update and delete in one step, which is impossible with any database management system AFAIK.

_________________________
- Vijay G
Strive for Perfection
 
Old May 4th, 2007, 01:01 AM
Authorized User
 
Join Date: Apr 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Vijay for that info that its impossible.

Regards,
Phani





Similar Threads
Thread Thread Starter Forum Replies Last Post
After Update Trigger debbiecoates SQL Server 2000 2 February 15th, 2008 04:55 AM
insert,update trigger rolle SQL Server 2000 3 September 29th, 2005 08:41 PM
Problem with update trigger gbrown SQL Language 2 September 4th, 2004 12:33 PM
Help With INSERT + UPDATE Trigger HenryE SQL Server 2000 1 December 11th, 2003 06:26 PM
Insert Update Trigger mstuart60 SQL Server 2000 10 September 30th, 2003 06:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.