Speed Up Import SQL docker mariadb

i faced very slow import query file in docker mariadb,the file only have size 250MB but it takes more than 6 hours to import (and not finished)

then find the config from dba.stackexchange.com , it bost my import file to under 5 minutes

using docker compose to running docker this my config

this my docker-compose.yml file

version: "3"
services:
  mariadb:
    image: mariadb
    volumes:
      - ./db:/var/lib/mysql:delegated
      - ./logs:/var/log/mysql
      - ./tmp:/tmp
      - ./custom.cnf:/etc/mysql/conf.d/custom.cnf
    ports:
      - 3306:3306
    environment:
      TZ: "Asia/Jakarta"
      MYSQL_ALLOW_EMPTY_PASSWORD: "no"
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_USER: "userdb"
      MYSQL_PASSWORD: "passdb"
      MYSQL_DATABASE: "test"

this my custom.cnf file

[mysqld]
# https://dba.stackexchange.com/questions/83125/mysql-any-way-to-import-a-huge-32-gb-sql-dump-faster
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads = 16
innodb_flush_log_at_trx_commit = 0

Leave a comment