What is the best practice, when It comes to return...
# exposed
m
What is the best practice, when It comes to returning a result from a query?
Copy code
fun getSymbolId(symbol: String): Int {
    transaction {
        Symbols.select { Symbols.symbol eq symbol }.toList().first()
    }
}
j
Symbols.select { Symbols.symbol eq symbol }.first()
will be more efficient.
.toList()
will pull all results into memory, whereas
.first()
will limit 1.
m
I see, but it wasn't really what I was asking. What's the best practice when it comes to returning the actual result of the select?
nvm, I figured it out 🙂