Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import 100 million rows table into database?

Tags:

database

mysql

Can any one guide me about my query?, i m making application for banking sector with fuzzy logic. i have to import table with 100 million rows daily. and i am using MySql for this application which is processing slowly. so is there any another server for handling my database which can access fast?

like image 924
Pranoti Avatar asked Jun 01 '11 11:06

Pranoti


People also ask

Can SQL handle 100 million records?

Use the SQL Server BCP to export big tables data This table includes 100 million rows and it's size is about 7.5 GB. In our first testing, we will run the SQL Server BCP with default values in order to export 100 M rows.

How long does it take to insert 1 million rows in SQL?

It takes about 3 mins to insert 1 million rows if I run it in the SQL server and take about 10 mins if I use C# program to connect from my desktop. The tableA has a clustered index with 2 columns. My target is to make the insert as fast as possible (My idea target is within 1 min).

How would you store millions of records in a table?

Another possibility is to create a time series in column oriented database like HBase or Cassandra. In this case you'd have one row per product and as many columns as hits. Last, if you are going to do it with the database, as @JosMac pointed, create partitions, avoid indexes as much as you can.

Can Postgres handle 100 million rows?

If you're simply filtering the data and data fits in memory, Postgres is capable of parsing roughly 5-10 million rows per second (assuming some reasonable row size of say 100 bytes). If you're aggregating then you're at about 1-2 million rows per second.


2 Answers

We roughly load about half that many rows a day in our RDBMS (Oracle) and it would not occur to me to implement such a thing without access to DBA knowledge about my RDBMS. We fine-tune this system several times a month and we still encounter new issues all the time. This is such a non-trivial task that the only valid answer is:

Don't play around, have your managers get a DBA who knows their business!

Note: Our system has been in place for 10 years now. It hasn't been built in a day...

like image 65
Lukas Eder Avatar answered Sep 19 '22 12:09

Lukas Eder


100 million rows daily?

You have to be realistic. I doubt any single instance of any database out there can handle this type of thouroughput efficiently. You should probably look at clustering options and other optimising techniques such as splitting data in two diffent DB's (sharding).

MySQL Enterprise has a bunch of features built-in that could ease and moniter the clustering process, but I think MySQL community edition supports it too.

Good-luck!

like image 24
stefgosselin Avatar answered Sep 21 '22 12:09

stefgosselin