title: Performance issue with simple select query (using indexes) in SQLite3
body: <p>I have a table named 'waveforms' with 525k rows. Each row contain 7 columns. Only the fisrt 5 columns are indexed since I use them in the query.</p>
  <p>I have a loop that calls a select query 152 905 times with different inputs. It's taking ~5min to finish, so ~2ms per call or ~500 queries per second (QPS).</p>
  <p>I think 500 QPS is a little bit slow for the type of query I'm doing. Is there anything else I can do to improve the performance?</p>
  <h3>python and sqlite version</h3>
  <p>Python 3.7.5</p>
  <p><code>print(sqlite3.version)</code>: 2.6.0</p>
  <h3>machine</h3>
  <p>Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz with 4 CPUs (laptop)</p>
  <p>Disk: SK hynix SH920 mSATA 256GB (Avg. 4K-64Thread Mixed IO Speed 108MB/s) <a href="https://ssd.userbenchmark.com/SpeedTest/5328/SK-hynix-SH920-mSATA-256GB" rel="nofollow noreferrer">c.f. benchmark</a></p>
  <p>RAM: 8GB</p>
  <h3>Create Table</h3>
  <pre><code>CREATE TABLE &quot;waveforms&quot; (
      &quot;sc_id&quot; integer,
      &quot;time&quot;  REAL,
      &quot;XYpos&quot; TEXT NOT NULL,
      &quot;NET&quot;   TEXT NOT NULL,
      &quot;simulator&quot; TEXT NOT NULL,
      &quot;CAT&quot;   integer DEFAULT 9,
      &quot;csv_file&quot;  BLOB NOT NULL,
      FOREIGN KEY(&quot;sc_id&quot;) REFERENCES &quot;scs&quot;(&quot;id&quot;),
      UNIQUE(&quot;sc_id&quot;,&quot;time&quot;,&quot;XYpos&quot;,&quot;NET&quot;,&quot;simulator&quot;)
  )
  
  </code></pre>
  <h3>Index</h3>
  <pre><code>CREATE INDEX &quot;index_waveform&quot; ON &quot;waveforms&quot; (
      &quot;sc_id&quot;,
      &quot;time&quot;,
      &quot;XYpos&quot;,
      &quot;NET&quot;,
      &quot;simulator&quot;
  )
  </code></pre>
  <h3>explain query plan</h3>
  <pre><code>explain query plan SELECT sc_id, time, XYpos, NET, simulator  FROM waveforms INDEXED BY index_waveform WHERE XYpos=&quot;111.95_115.80&quot; AND sc_id=1 AND time=3.98e-09 AND NET=&quot;NET_X&quot; AND simulator=&quot;simX&quot;;
  QUERY PLAN
  `--SEARCH TABLE waveforms USING COVERING INDEX index_waveform (XYpos=? AND NET=? AND sc_id=? AND time=? AND simulator=?)
  </code></pre>
  <h3>explain</h3>
  <pre><code>explain SELECT sc_id, time, XYpos, NET, simulator  FROM waveforms INDEXED BY index_waveform WHERE XYpos=&quot;111.95_115.80&quot; AND sc_id=1 AND time=3.98e-09 AND NET=&quot;NET_X&quot; AND simulator=&quot;simX&quot;;
  ----  -------------  ----  ----  ----  -------------  --  -------------
  0     Init           0     18    0                    00  Start at 18  
  1     OpenRead       1     61730  0     k(6,,,,,,)     02  root=61730 iDb=0; index_waveform
  2     Integer        1     1     0                    00  r[1]=1       
  3     Real           0     2     0     3.98e-09       00  r[2]=3.98e-09
  4     String8        0     3     0     111.95_115.80  00  r[3]='111.95_115.80'
  5     String8        0     4     0     NET_X  00  r[4]='NET_X'
  6     String8        0     5     0     simX  00  r[5]='simX'
  7     SeekGE         1     17    1     5              00  key=r[1..5]  
  8       IdxGT          1     17    1     5              00  key=r[1..5]  
  9       Column         1     0     6                    00  r[6]=waveforms.sc_id
  10      Column         1     1     7                    00  r[7]=waveforms.time
  11      RealAffinity   7     0     0                    00               
  12      Column         1     2     8                    00  r[8]=waveforms.XYpos
  13      Column         1     3     9                    00  r[9]=waveforms.NET
  14      Column         1     4     10                   00  r[10]=waveforms.simulator
  15      ResultRow      6     5     0                    00  output=r[6..10]
  16    Next           1     8     1                    00               
  17    Halt           0     0     0                    00               
  18    Transaction    0     0     7     0              01  usesStmtJournal=0
  19    Goto           0     1     0                    00               
  </code></pre>
  <h3>Some PRAGMAS:</h3>
  <pre><code>Auto Vacuum: None
  Automatic IndeX: yes
  Foreign Keys: yes
  Journal Mode: WAL
  Journal Size Limit: -1
  Locking Mode: Normal
  Max Page Count: 1073741823
  Page Size: 4096
  Secure Delete: yes
  Synchronous: Normal
  Temp Store: Default
  WAL Auto Checkpoint: 1000
  </code></pre>