efficient way to transfer 18MB of data
I have an application where I get information about products everyday.
The file's size is about 18MB. Everyday, products may be added, updated
Which is more efficient way to update teh database,
1. delete all rows and then again insert data again.
2. programatically check which product has changed and only update
I have to use PHP. Each line in the file is about a product and each
field is tab separated. Any one of the field may change. So, I would
have to check each and every field which incurs one more problem, data
has to be transfered in and out of the database server.
So I wanted to know which one of the method is more efficient.
Re: efficient way to transfer 18MB of data
The debate can continue for ever as to which is better deleting all rows and inserting new data or the searching which rowschanged and update the following but here are some pros and cons of each method and after this its upto you to decide which pros I can do with and use that method.
1. Deleting all the rows.
2. Updating selected rows.
When the size of the table increases the its always better to go with the option no 2 and so the final conclusion that comes to my mind is 2. Updating selected rows but it might so happen that in your situation 1. Deleting all the rows may be better one. So its you who can better decide which is better.
I hope this solves your query or at least helps you in that direction.
|All times are GMT +5.5. The time now is 09:22.|