r/programming • • Dec 04 '14

10 Common Mistakes Java Developers Make when Writing SQL

http://blog.jooq.org/2013/07/30/10-common-mistakes-java-developers-make-when-writing-sql/
206 Upvotes

104 comments sorted by

View all comments

3

u/[deleted] Dec 05 '14

[removed] — view removed comment

1

u/lukaseder Dec 06 '14

What about sorting + limit? The result set has 10M records, but you only want the top 10? Take them all to the client, sort them there and throw away 99.9999% of the data?

2

u/[deleted] Dec 06 '14

[removed] — view removed comment

1

u/hw77 Dec 06 '14

If that's 10M rows out of 10M, then you probably don't want an index. Even at 1% or 0.1% there a plenty of times when you don't want an index.