Select Distinct DTO in 10 million records with JPA/JPQL
I want to retrieve all the distinct rows in MyClazz, which have million rows, depending on var1 and var2.
Running this with Kotlin and PostgreSQL, we get an Out of Memory Exception.
Would there be any better approach?
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
[...]
@Query("SELECT DISTINCT new MyClazzDAO(var1, var2) FROM MyClazz ")
fun findDistinctModelsPerPlatform(): List