Note that there are some explanatory texts on larger screens.

plurals
  1. POPriority Database size or Performance c#
    primarykey
    data
    text
    <p>Sometimes we find our self in situation where we have to choose one from database size or performance.</p> <p>I am working on application for bill accounting in which i store details of bill in table design </p> <pre><code> BillNo ProductName Qty Rate 1 aaaa 1 12 </code></pre> <p>I learned that its not good to store data we can calculate at run time in database like <code>Amount(Qty*Rate)</code> <code>, Tax(Amount*5/100)</code>.</p> <p>But at some point i need Total amount and total vat for thousands of entries, if i follow above approach first i need to select <code>Qty , Rate</code> then perform multiplication for each row then perform addition which will be definitely time consuming.</p> <p>What i was thinking:- Move on with approach which stores data like </p> <pre><code> BillNo ProductName Qty Rate Tax Amount 1 aaaa 1 12 4 16 </code></pre> <p><strong>Disadvantage:-</strong></p> <ol> <li>Need to store extra data in database and which will increase some performance overhead also for insertion of Tax and Amount.</li> </ol> <p><strong>Advantage:-</strong></p> <ol> <li>Need to select only one value from database.</li> <li>No need to perform multiplication operation, which will improve my performance. </li> </ol> <p>Which one is better and efficient in condition like this .</p> <p>Above question is just an example to explain the condition. Mainly question is about whether i go with computed columns or calculation during retrieval. As Calculation during retrieval is good if you don't have large no of records but it is against database rules. Is choice between computed columns or calculation during retrieval depend upon no of records.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload