I have something like
SELECT var1,var2 FROM table where var3=X AND var4=Y order by var5 desc limit 1;
Running this query takes roughly 5 seconds on my database which is far to slow. I was wondering if there was any way to retrieve the last row in a way similar to this
SELECT var1,var2 FROM table where var3=X AND var4=Y limit 1;
bcause that is almost instant (.03 seconds) on my database. So, if there was some way to have a query print everything in reverse order that would solve every issue I am having. I have been searching for a long while now and every answer seems to be with using ORDER BY or subqueries which are all >= 5 seconds.
EDIT The tables are not indexed.