Quantcast
Channel: Question and Answer » transaction
Viewing all articles
Browse latest Browse all 35

calling multiple procedures from my application Vs calling procedures inside another procedure

$
0
0

I have a scenario of saving user details into my database(MySQL 5.1); i have three tables for saving user details; user_data,user_contact,user_address, so if i insert one user data i have to check for existence of data in these tables. i have different functions for checking and procedures for insert into separate tables, So that i can use them separately and together depends on needs/situations.

insertion requires the following steps:

  1. check of existence of data/s in user_data if exist skip the insertion, if not insert details.
  2. check of existence of data/s in user_contact if exist skip the insertion and update contact_gid in user table, if not insert details and update contact_gid in user table.
  3. similar in the case of user_address.

Here my question is that,
Which method is more efficient?

  1. calling each separate procedure/function from my .net application,
    check for condition and call the next based on the condition using a
    single transaction.

  2. Pass all required parameters(for all functions) to a single procedure,
    the condition checking and further executions are handled within this
    procedure.


Viewing all articles
Browse latest Browse all 35

Trending Articles