Re: Issue with the huge import script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 16 Aug 2009 04:15:12 +0300, Devendra Jadhav <devendra.in@xxxxxxxxx> wrote:

Is it because of the size of the records or something else...?

Please suggest me some solution which is faster, safe and easy to code :D


What about using insert ignore ? :)

1. add UNIQUE constraint on a key you want to add, so you won't be able to add row with same ID twice.
2. then use INSERT IGNORE into ....

=> easy to code, easy to use.

Of course, this aproach won't work if database will grow larger and larger. (if you adding new rows all the time)

Then it is better to use this aproach:

1. add auto_increment column to original table.
2. before getting new rows from old table, check what is maximum ID from new table. 3. get only rows where old_table.id > new_table.max_id remember to ORDER BY ID ASC.



--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux