Posts

Showing posts with the label DATABASE

getResultStream() in JPA 2.2

" The Stream API provides a great way to process the result set. But please keep in mind that databases are highly optimized to work with huge datasets and can do that a lot faster than your Java code. So, it’s better to perform all filter, limit and sorting operations in the database and just use the Stream to iterate through the result set. " https://www.thoughts-on-java.org/jpa-2-2s-new-stream-method-and-how-you-should-not-use-it/

Database View vs Materialized View & How to refresh Materialized Views

View reduces the complexity of queries is a virtual table, created using Create View command is computed each time it is used or accessed => Slow Performance, No storage required updates in tables reflect immediately in the View (and vice versa), however, view created using DISTINCT, Group By etc. cant be updated Materialized View is a physical, precomputed copy of the data => Fast access, storage required Changes in original tables are not reflected in materialized views Must be updated via triggers, or "REFRESH" instruction in view creation statement See more:  https://techdifferences.com/difference-between-view-and-materialized-view.html How to refresh Materialized Views CREATE MATERIALIZED VIEW my_view_1    TABLESPACE ...    REFRESH FAST NEXT sysdate + 7    AS SELECT * FROM ...; "The statement does not include a START WITH parameter, so Oracle Database determines the first automatic refresh time by evaluating the NEXT value...

jOOQ

jOOQ generates Java code from your database and lets you build typesafe SQL queries through its fluent API. jOOQ has a simple templating engine that can be used with plain SQL. jOOQ's and MyBatis' have simple POJO mapping capabilities. http://www.jooq.org/

JPA & Database-Performance

Nice article regarding JPA and database performance: https://weblogs.java.net/blog/caroljmcdonald/archive/2009/08/28/jpa-performance-dont-ignore-database-0

Database Change Management

You never develop code without version control, why do you develop your database without it? Liquibase is an open source (Apache 2.0 Licensed), database-independent library for tracking, managing and applying database changes. It is built on a simple premise: All database changes are stored in a human readable yet trackable form and checked into source control.... http://www.liquibase.org/