• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Insert 1 milion record

#11
if using post, you can using form validation with is_unique.
Reply

#12
(11-07-2017, 09:42 AM)omid_student Wrote:
(09-29-2017, 03:17 PM)ciadvantage Wrote:
(09-29-2017, 02:31 PM)omid_student Wrote:
(09-29-2017, 02: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
ID isnt.  I would have it as primary key then problem is solved

Ok for insert ID,my problem solved.
Now how do i insert many record?(about 1 million)

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.

Hey i cannot access to command line mysql
How do it?

The best way is using MySQL Tools like MySQL Workbench, Navicat, SQLyog to do the Import / Export.
Reply

#13
I second the use of mysql's load data infile. I worked on a project once where they with dealing with millions of rows of data reqularly, with data normalization, etc. We handled that by using load data to load the CSV to a temporary table at which point we could removed duplicates, normalize, etc. before merging into the rest of the working data. Worked pretty well.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.