Title: Add further JPA performance rules · Issue #38 · devonfw/java · GitHub
Open Graph Title: Add further JPA performance rules · Issue #38 · devonfw/java
X Title: Add further JPA performance rules · Issue #38 · devonfw/java
Description: There're a lot of things in regards of performance to take into consideration when using JPA. Those should be documented as rules in the JPA performance article. A list of possible rules that @hohwille suggested in #27 : Only load the da...
Open Graph Description: There're a lot of things in regards of performance to take into consideration when using JPA. Those should be documented as rules in the JPA performance article. A list of possible rules that @hohw...
X Description: There're a lot of things in regards of performance to take into consideration when using JPA. Those should be documented as rules in the JPA performance article. A list of possible rules that @...
Opengraph URL: https://github.com/devonfw/java/issues/38
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add further JPA performance rules","articleBody":"There're a lot of things in regards of performance to take into consideration when using JPA.\r\nThose should be documented as rules in the JPA performance article.\r\n\r\nA list of possible rules that @hohwille suggested in #27 :\r\n\r\n* Only load the data you need\r\n* Only load the data when you need it (e.g. in a search result screen you do not need to have all the details loaded from DB tier to app tier into frontend but only minimal sets of the records to display, once the user selects a search result for expansion or to open details screen then load the details for that record).\r\n* Declare all your JPA relations as lazy but avoid triggering of lazy loading at all - it is a stupid feature of JPA. Either you do not need to load things at all in your TX or you need them. If you do, then lazy loading only leads to N+1 problems and waste so simply load eagerly then (not via Annotations but via the query - e.g. using FETCH JOIN).\r\n* Check the execution plans of all your queries, in case of Oracle check AWRs and statistics frequently on production\r\n* Create indices - a rule of thumb is create an index for every foreign key column and consider indexes for all searched columns but not blindly but after checking execution plans\r\n* General rule: Ensure to have an expert for your DB technology in your project in case you are doing something serious (millions of records, anything below is peanuts and may work without deeper knowledge)\r\n* Avoid conversions (Cast, TO_DATE, TO_NUMBER, etc.) in your SQLs\r\n* Ensure that data-types in variable bindings fit to your DDL. Oracle does not convert the given variable value to the DDL type to convert to but instead converts every column value to the data-type you provided what can lead to catastrophic performance and DB CPU drain, etc.\r\nNever use Criteria API - it sucks and leads to disaster (I have rescued a big-data project and mean it)\r\n* Do explicit joins (selecting from multiple tables and then \"joining\" in WHERE clause makes hibernate to do cross-join what makes Oracle build the Cartesian product before evaluating the WHERE clause. If both tables to \"join\" are really big this will lead to an ultimate disaster (DB IO death)\r\n* Avoid WHERE ID IN (...) expressions and be aware of limitations (1000 values for Oracle). Instead think if you can use a sub-query to avoid having the list of IDs in the first place.\r\nso much more to tell - we should collect input from DB community, projects, etc. to get all the valuable knowledge collected.","author":{"url":"https://github.com/baumeister25","@type":"Person","name":"baumeister25"},"datePublished":"2023-03-21T09:27:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/38/java/issues/38"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6060525b-18ba-4d44-7716-a35fe2e25dcc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 90A8:B2EF0:12EF3A4:19706D2:69813959 |
| html-safe-nonce | 069071e97ff6532deea8444ef0e95934a68c62eb5708f83b753cfbdb939d92dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MEE4OkIyRUYwOjEyRUYzQTQ6MTk3MDZEMjo2OTgxMzk1OSIsInZpc2l0b3JfaWQiOiI3MjU2NTEzMTcxNTM4NjU1NTc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 407b5201c3e460b238196bdaac915534d42af9e7a2185bef98f7910d7d8c3b39 |
| hovercard-subject-tag | issue:1633515309 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/devonfw/java/38/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ec86ca8ab85af77722c5877ec583773c8b194430d28965097549b36070650bde/devonfw/java/issues/38 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ec86ca8ab85af77722c5877ec583773c8b194430d28965097549b36070650bde/devonfw/java/issues/38 |
| og:image:alt | There're a lot of things in regards of performance to take into consideration when using JPA. Those should be documented as rules in the JPA performance article. A list of possible rules that @hohw... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | baumeister25 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 39fe8101494cbb823c09b619b68c80cd4d05ab7279997038dbe06bb91608abe1 |
| turbo-cache-control | no-preview |
| go-import | github.com/devonfw/java git https://github.com/devonfw/java.git |
| octolytics-dimension-user_id | 7803029 |
| octolytics-dimension-user_login | devonfw |
| octolytics-dimension-repository_id | 556587761 |
| octolytics-dimension-repository_nwo | devonfw/java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 556587761 |
| octolytics-dimension-repository_network_root_nwo | devonfw/java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d5b34a4e4898b066c629879feb4b184bc471d6a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width