# Simultaneous LOAD DATA INFILE and SELECT

**URL:** <https://forums.percona.com/t/simultaneous-load-data-infile-and-select/957>\
**Category:** Other MySQL® Questions\
**Created:** [October 10, 2008, 9:42am UTC](https://forums.percona.com/t/simultaneous-load-data-infile-and-select/957 "2008-10-10T09:42:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cowboymathu](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cowboymathu](https://forums.percona.com/u/cowboymathu)\
**Post date:** [October 10, 2008, 9:42am UTC](https://forums.percona.com/t/simultaneous-load-data-infile-and-select/957/1 "2008-10-10T09:42:55Z")

</div>

Hi all,

When LOAD DATA INFILE query is executed if SELECT from same\_table is executed, the SELECT query is locked. I want to run both queries simultaneously. How can I achieve that.

Thanks,

---

<div class="post-metadata">

**Author:** ![lyolechka](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@lyolechka](https://forums.percona.com/u/lyolechka)\
**Post date:** [October 14, 2008, 5:49am UTC](https://forums.percona.com/t/simultaneous-load-data-infile-and-select/957/2 "2008-10-14T05:49:49Z")

</div>

Hi cowboymathu,

What storage engine is your table? In MyIsam you can use LOAD DATA CONCURRENT INFILE to allow concurrent reads from the table while you are inserting into it. This can slow the performance of LOAD DATA especially with large amounts of data to load and also may lead to inconsistent reads from the table. More here: [URL][http://dev.mysql.com/doc/refman/5.0/en/load-data.html[/URL]](http://dev.mysql.com/doc/refman/5.0/en/load-data.html%5B/URL%5D)

An alternative would be: create a copy of the table you want to load data to load data into the copy, swap table names when load is done.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![cowboymathu](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@cowboymathu](https://forums.percona.com/u/cowboymathu)\
**Post date:** [October 15, 2008, 8:00am UTC](https://forums.percona.com/t/simultaneous-load-data-infile-and-select/957/3 "2008-10-15T08:00:35Z")

</div>

Hi lyolechka,

Thanks for your reply. Yes, I am using MyISAM type with partitioning. Currently I am using LOAD DATA CONCURRENT INFILE syntax but seems it does not allow me to do simultaneous SELECT.

Your alternative idea seems better but in my instance I am using table with both partition and sub partition and which has almost 1 billion (1000 millions) of records. It eats more than 400 GB in capacity. So making copy is not feasible in this.

Any better way in my case?
