# Mysql JDBC Extremely Slow

**URL:** <https://discuss.elastic.co/t/mysql-jdbc-extremely-slow/61709>\
**Category:** Logstash\
**Created:** [September 28, 2016, 2:24pm UTC](https://discuss.elastic.co/t/mysql-jdbc-extremely-slow/61709 "2016-09-28T14:24:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bv3435](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@bv3435](https://discuss.elastic.co/u/bv3435)\
**Post date:** [September 28, 2016, 2:24pm UTC](https://discuss.elastic.co/t/mysql-jdbc-extremely-slow/61709/1 "2016-09-28T14:24:10Z")

</div>

I am trying to move to logstash from the elasticsearch-jdbc river to run a query on a table with 100M+ rows but it is extremely slow with logstash even after tuning the parameters and running it on 32 threads. I had to use paging as even with it set to 24GB memory I will get an out of memory error. I am using the official mysql jdbc jar and the logstash config is below. Logstash is putting in about 1k rows per minute and elasticsearch-jdb river puts in almost a 1 million per minute on a 16 core 32GB memory machine. The difference is huge. Also CPU usage on logstash is extremely low, it's barely using any.

```
input {
    jdbc {
        jdbc_driver_library => "/root/mysql-connector-jdbc/mysql-connector-java-5.1.39-bin.jar"
        jdbc_connection_string => "jdbc:mysql://localhost:3306/table"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_user => "root"
     	jdbc_password => "PASSWORD"
        jdbc_page_size => 100000
     	jdbc_paging_enabled => true
    	statement => "SELECT * FROM a"
    }
}
output {
    elasticsearch {
        index => "test"
        document_type => "test"
        document_id => "%{id}"
        hosts => "localhost"
        flush_size => 512
    	workers => 32
    }
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:36am UTC](https://discuss.elastic.co/t/mysql-jdbc-extremely-slow/61709/2 "2017-07-06T04:36:33Z")

</div>


