I have been working a lot with JavaFX recently and it’s been a while since doing any SQL work.

After loading my project and running a few test commands I was pretty shocked to see that the SELECT statements were taking almost 15 seconds to produce a response!

Thankfully I quickly remembered I needed to reindex the table.

So as that I don’t forget again, best to make a note.

#INDEX THE TABLE
CREATE INDEX idx_mytable ON mytable(field1, field2);
#DROP THE INDEX
ALTER TABLE mytable DROP INDEX idx_mytable;

Select query without index – Query completed in 15,333 ms

Select query with index – Query completed in 7 ms

Much better.