I was really unsatisfied about the performance of my event stream processing engine using Threshold Algorithm. Today, I suddenly realized that I didn't update database statistics after I created the indexes, and loaded some data. As a consequence, database could not use the indexes to optimize the query execution plan.
Statistics can be updated using "analyze" command in PostgreSQL and MySQL. After I executed the command, I'm really glad to see that the performance is twice as good as before!