Consider the following relations in a database of a bank system. Customer (card-num,…
- User
Consider the following relations in a database of a bank system. Customer (card-num, customer-id, country) Bank (bank-code, name, country) Transactions (card-num, bank-code, amount) • Customer.card-num: identifier of the bank card • Customer.customer-id: identifier of the card owner • Customer.country: location of the card owner • Bank.bank-code: identifier of the bank • Bank.name: name of the bank • Bank.country: location of the bank • Transactions.card-num: foreign key referencing Customer • Transactions.bank-code: foreign key referencing Bank • Transactions.amount: total amount of transactions with a card in a bank • Primary key attributes are underlined. The three relations Customer, Bank, and Transactions are stored at Site 1, Site 2, and Site 3, respectively, and the following information is available: • Number of records in Customer = 120,000 • Number of records in Bank = 3,000 • Number of records in Transactions = 300,000 • 20% of the cards have no transactions. • Size of card-num = 4 bytes • Size of customer-id = 12 bytes • Size of country = 10 bytes • Size of bank-code = 4 bytes • Size of name = 20 bytes • Size of amount = 8 bytes The following SQL query submitted at Site 2 (and therefore the query result is needed at Site 2) retrieves the customer identifier, bank name, and amount for all transactions where the customers are located in the same country as the bank (i.e., retrieving the information of local transactions). SELECT Customer.customer-id, Bank.name, Transactions.amount FROM Customer, Bank, Transactions WHERE Customer.card-num = Transactions.card-num AND Transactions.bank-code = Bank.bank-code AND Bank.country = Customer.country Suppose the performance criterion is to minimize the data transmission cost. Based on the available information, for each of the following estimated number of output tuples, suggest a strategy for executing this query. Find the data transmission cost in number of bytes in each transfer between sites and compute the total data transmission cost at the end. In case the exact number of tuples cannot be determined from the given information, you may use the worst-case estimate. In your strategy, you must clearly specify the operations done at each site to ensure that the set of output tuples of your strategy is the same as that of the above query. (i) 250,000 (ii) 30,000
- Assistant
(i) For an estimated number of 250,000 output tuples:
- Site 1 (Customer):
- Retrieve all customer records.
- Send the records to Site 2.