Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Friday, August 3, 2012

MySQL VS Oracle SQL

Listed below are ways to achieve the same in Oracle SQL as in MySQL:

The equivalent of LIMIT in MySQL is ROWNUM in Oracle SQL:
MySQL: SELECT * FROM table LIMIT 10;
Oracle SQL: SELECT * FROM table WHERE ROWNUM <= 10

Solution found at: http://www.delphifaq.com/faq/databases/oracle/f594.shtml

Wednesday, March 21, 2012

MySQL specify index without FORCE INDEX

Here's a blog post from Shlomi Noach which displays some useful steps to consider when optimizing MySQL querie where MySQL chooses an inefficient index.
It helped me. Especially the part about tricking MySQL to not use an index, without using USE INDEX or FORCE INDEX (which can be very bad if you have a dynamic query or your tables change/grow, something they usually do).

http://code.openark.org/blog/mysql/7-ways-to-convince-mysql-to-use-the-right-index

Note that Solution #7: Make MySQL think the problem is harder than it really is can also be applied to GROUP BY. e.g. GROUP BY id, type, level