# Mysql query speed slow, cause offset

**URL:** <https://discuss.elastic.co/t/mysql-query-speed-slow-cause-offset/262868>\
**Category:** Logstash\
**Created:** [February 1, 2021, 4:58pm UTC](https://discuss.elastic.co/t/mysql-query-speed-slow-cause-offset/262868 "2021-02-01T16:58:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![star\_gold](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/star_gold/32/83229_2.png) [@star\_gold](https://discuss.elastic.co/u/star_gold)\
**Post date:** [February 1, 2021, 4:58pm UTC](https://discuss.elastic.co/t/mysql-query-speed-slow-cause-offset/262868/1 "2021-02-01T16:58:58Z")

</div>

this is my config file:  
`  
input {  
jdbc {  
jdbc\_driver\_library =\> "/tmp/logstash/logstash-7.9.3/mysql/mysql-connector-java-8.0.16.jar"  
jdbc\_driver\_class =\> "com.mysql.cj.jdbc.Driver"  
jdbc\_page\_size =\> 3  
tracking\_column =\> "id"  
use\_column\_value =\> true

# record\_last\_run =\> true

```
jdbc_connection_string => "jdbc:mysql://192.168.50.254:33066/kuzi?serverTimezone=Asia/Shanghai&useCursorFetch=true"
    jdbc_fetch_size => 5
jdbc_user => cc
jdbc_password => cccc
jdbc_paging_enabled => true
tracking_column_type => "numeric"

```

# schedule =\> "0 0 0 1/1 \* ?"

```
statement => "SELECT * from qq_copy1 where id > :sql_last_value "

```

}  
}

output {

# stdout { codec =\> "rubydebug"}

elasticsearch {  
index =\> "qqq"  
hosts =\> ["127.0.0.1:9200"]  
document\_id =\> "%{id}"  
}  
}  
`  
I hope query order is  
select \* from (select \* from qq\_qqcopy1 where id \> 0) limit 3 offset 0  
select \* from (select \* from qq\_qqcopy1 where id \> 3) limit 3 offset 0  
select \* from (select \* from qq\_qqcopy1 where id \> 6) limit 3 offset 0  
use this query mode.

i have mass data, if statement is 'SELECT \* from qq\_copy1', query speed very slow. so help please

---

<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:** [March 1, 2021, 4:59pm UTC](https://discuss.elastic.co/t/mysql-query-speed-slow-cause-offset/262868/2 "2021-03-01T16:59:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
