Sometimes I want to select * from some table just to see some sample data and its format.
When using SQL Developer with an Oracle database it's no problem at all.
The issue appears when I try to do the same in a MySQL database. As it will try to get the entire table in the server before showing me the first rows in the query result tab.
Is there anything that I can configure or should I just add a LIMIT clause to every query similar to this one?
See the Sql Developer User Guide.
Max rows to print in a script: Limits the number of rows displayed.
You can set the Database preferences to limit the rows. Then run your query using F5 and it will limit the results to that value.
Thank you for the link to the manual, I didn't see that, only the help in the program.
That didn't solve it. I cannot see exactly what happens on the the server, but it looks like the servers selects all the rows in the table and put them in memory before sending me the first 50 rows or whatever I have in that field.
Writing a LIMIT clause in the queries make a big difference even if they are bigger than the "max rows" in SQL Developer
You might also try checking the MySQL documentation. I found the following, which states that whether JDBC's setFetchSize API works properly or not depends on the both the MySQL server version and the JDBC driver in use:
When using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier than 5.0.3, the
setFetchSize()method has no effect, other than to toggle result set streaming as described above.
Hope this helps,
SQL Developer Team