From d3a20a4bee6b714244953345432bb92bd5c22a26 Mon Sep 17 00:00:00 2001
From: Daniel <daniel@harvey>
Date: Fri, 20 Dec 2019 09:46:11 +0100
Subject: [PATCH] DOC MAINT: Notes on benchmarking, renaming variable.

---
 doc/devel/Benchmarking.md                     | 28 +++++++++++++++++++
 .../MySQL/MySQLRetrieveSparseEntity.java      |  6 ++--
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/doc/devel/Benchmarking.md b/doc/devel/Benchmarking.md
index a244a3a6..c7dc0bf2 100644
--- a/doc/devel/Benchmarking.md
+++ b/doc/devel/Benchmarking.md
@@ -11,3 +11,31 @@ Benchmarking can be done using the `TransactionBenchmark` class (in package
 - To work with the benchmarks of often used objects, use these methods:
   - `Container.getTransactionBenchmark().addBenchmark()`
   - `Query.addBenchmark()`
+
+# Miscellaneous Notes #
+
+Notes to self, details, etc.
+
+## On method calling order and benchmarked events ##
+
+- `Transaction.execute()` :: Logs benchmarks for events like:
+  - `INIT`
+  - `PRE_CHECK`
+  - `CHECK`
+  - `POST_CHECK`
+  - `PRE_TRANSACTION`
+  - `TRANSACTION` -> typically calls
+    `database.backend.transaction.[BackendTransaction].execute()`, which in turn
+    calls, some levels deeper, `backend.transaction.....execute(<k extends
+    BackendTransaction> t)` -> see next point
+  - ...
+- `backend.transaction.....execute(transaction)` :: This method is benchmarked
+  again, this is probably the deepest level of benchmarking.  It finally calls
+  `[MySQLTransaction].execute()`.
+- `[MySQLTransaction].execute()` :: This is the deppest backend implementation
+  part, it typically creates a prepared statement and executes it.
+- Currently not benchmarked separately:
+  - Getting the actual implementation (probably fast?)
+  - Preparing the SQL statement
+  - Executing the SQL statement
+  - Java-side caching
diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveSparseEntity.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveSparseEntity.java
index 9536a596..30a07213 100644
--- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveSparseEntity.java
+++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveSparseEntity.java
@@ -43,10 +43,10 @@ public class MySQLRetrieveSparseEntity extends MySQLTransaction
   @Override
   public SparseEntity execute(final int id) throws TransactionException {
     try {
-      final PreparedStatement prepareStatement = prepareStatement(stmtStr);
+      final PreparedStatement preparedStatement = prepareStatement(stmtStr);
 
-      prepareStatement.setInt(1, id);
-      final ResultSet rs = prepareStatement.executeQuery();
+      preparedStatement.setInt(1, id);
+      final ResultSet rs = preparedStatement.executeQuery();
       try {
         return DatabaseUtils.parseEntityResultSet(rs);
       } finally {
-- 
GitLab