![]() |
Insert 1 milion record - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Insert 1 milion record (/showthread.php?tid=69041) Pages:
1
2
|
Insert 1 milion record - omid_student - 09-29-2017 I have many record that my operator have to insert it to database Also i have to check this record's ID for existing it in database What is best way to add them in database and check existing ID in database Example: Name ID Omid 1 Tohid 2 Saed 3 Abbas 4 Suppose referenced records is 1 million I want to know how add records in database and check which id is duplicate RE: Insert 1 milion record - ciadvantage - 09-29-2017 Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like ID isnt. I would have it as primary key then problem is solved RE: Insert 1 milion record - omid_student - 09-29-2017 (09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like Ok for insert ID,my problem solved. Now how do i insert many record?(about 1 million) RE: Insert 1 milion record - ciadvantage - 09-29-2017 (09-29-2017, 01:31 PM)omid_student Wrote:(09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like you can do from code level but it is not recommended. I found it is easier just use this https://dev.mysql.com/doc/refman/5.7/en/load-data.html ie. using command from mysql > LOAD DATA INFILE 'users.txt' INTO TABLE yourdb.users; /* Assume you have db name as yourdb and table users, your users.txt should be comma seperated */ Try a simple test file with few names to see how it goes then you can go from there. RE: Insert 1 milion record - omid_student - 09-30-2017 (09-29-2017, 02:17 PM)ciadvantage Wrote:(09-29-2017, 01:31 PM)omid_student Wrote:(09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like It is good solution THanks RE: Insert 1 milion record - ciadvantage - 09-30-2017 My pleasure! RE: Insert 1 milion record - omid_student - 10-01-2017 (09-30-2017, 02:20 PM)ciadvantage Wrote: My pleasure! My Love! RE: Insert 1 milion record - omid_student - 11-07-2017 (09-29-2017, 02:17 PM)ciadvantage Wrote:(09-29-2017, 01:31 PM)omid_student Wrote:(09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like Hey i cannot access to command line mysql How do it? RE: Insert 1 milion record - Narf - 11-07-2017 (11-07-2017, 08:42 AM)omid_student Wrote: Hey i cannot access to command line mysql Obtain access. RE: Insert 1 milion record - omid_student - 11-07-2017 (11-07-2017, 08:54 AM)Narf Wrote:(11-07-2017, 08:42 AM)omid_student Wrote: Hey i cannot access to command line mysql Yes Yes |