# JDBC Input (MSSQL) to CSV output to slow - memory no way near Xmx

**URL:** <https://discuss.elastic.co/t/jdbc-input-mssql-to-csv-output-to-slow-memory-no-way-near-xmx/182573>\
**Category:** Logstash\
**Created:** [May 24, 2019, 7:12am UTC](https://discuss.elastic.co/t/jdbc-input-mssql-to-csv-output-to-slow-memory-no-way-near-xmx/182573 "2019-05-24T07:12:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![romariol](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@romariol](https://discuss.elastic.co/u/romariol)\
**Post date:** [May 24, 2019, 7:12am UTC](https://discuss.elastic.co/t/jdbc-input-mssql-to-csv-output-to-slow-memory-no-way-near-xmx/182573/1 "2019-05-24T07:12:35Z")

</div>

Hello everyone,

I'm having a use case where I have a JDBC input to a MSSQL server, fetching all the rows and writing them to a CSV file. the table is quite big (+/- 90 million records) so getting the data and writing it to a csv file without setting any parameters should results in a high memory usage or even out of memory. However, my JVM is stable at +/- 900mb while I would expect it to be near 3gb (my Xmx). No matter what I do, it looks like that I can't increase the throughput.  
I have both used the sqljdbc42 and the mssql-jdbc-7.2.2.jre8.jar. No success with both. My config looks like this:

```
input {
  jdbc {
    jdbc_driver_library => "../driver/sqljdbc42.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    jdbc_connection_string => "jdbc:sqlserver://test\test2;database=testdb;user=testuser;password=testpassword"
	jdbc_user => nil
    statement => "SELECT * from [dbo].[xxx] WHERE id > :sql_last_value"
    use_column_value => true
    tracking_column => "id"	
	schedule => "52 8 * * *"
    }
}

output {
    csv {
		fields => ["field1","field2","field3"]
		path => "C:\output.csv"
    }
}

```

Can someone please help me out?

Thanks

---

<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:** [June 21, 2019, 7:12am UTC](https://discuss.elastic.co/t/jdbc-input-mssql-to-csv-output-to-slow-memory-no-way-near-xmx/182573/2 "2019-06-21T07:12:39Z")

</div>

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