Logstash jdbc input jdbc_fetch_size not working making first load extremely slower

I could fetch 100K in 30 mins , gets stuck for full 4M fetch from DB. My concern is jdbc_fetch_size it doesn't have any effect at all. I tried to limit the batch size in query itself by using ROWNUM but after fetching first batch, next batch stucks forever.