0

I am inserting data from a csv file to mysql datebase using PHP but I can't INSERT more then 922 lines . Every time the number of the lines is different, usually it is 841 or 837 but after restart my mysql-server PC it has the maximum number - 922 rows. I am runing Ubuntu server 16.04

vi /var/log/mysql/error.log is :

0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 223238094ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)

5
  • 1
    If you're using a .csv to import, I highly recommend using LOAD DATA LOCAL INFILE .... Have a look here for a proper example. Commented Jun 8, 2016 at 14:01
  • Make sure you're not somehow executing an insert query per line of code, that'sbadman Commented Jun 8, 2016 at 14:02
  • 1
    Isn't it more likely that your PHP script takes too long and times out than a bug in MySQL Server? Commented Jun 8, 2016 at 14:06
  • possible duplicate of MYSQL import data from csv using LOAD DATA INFILE Commented Jun 8, 2016 at 14:07
  • 1
    I bet if you look at the PHP ERROR LOG you will see a Time Limit Exceeded message Commented Jun 8, 2016 at 14:09

2 Answers 2

1

The innodb_page_cleaners default value was changed from 1 to 4 in MySQL 5.7.8. If the number of page cleaner threads exceeds the number of buffer pool instances, innodb_page_cleaners is automatically set to the same value as innodb_buffer_pool_instances.

Check innodb_buffer_pool_instances with: mysql> SHOW GLOBAL VARIABLES LIKE innodb_buffer_pool_instances:

You can only set innodb_page_cleaners as high as innodb_buffer_pool_instances. If you want innodb_page_cleaners=4 then you also need innodb_buffer_pool_instances=4.

Sign up to request clarification or add additional context in comments.

Comments

0

You can try MySQL - LOAD DATA... in PHP with mysql_query function.

LOAD DATA LOCAL INFILE 'file_name_with_full_path'
            INTO TABLE table_name
            FIELDS TERMINATED BY ',' 
            OPTIONALLY ENCLOSED BY '"' 
            LINES TERMINATED BY '\n'
            (TABLE_FIELDS)

For more details - http://dev.mysql.com/doc/refman/5.7/en/load-data.html

Thanks.

1 Comment

Yes, LOAD DATA statement consider as SQL statement and use this statement as query in mysqli_query function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.