Experimental quantum-assisted key-value store and reversible oracle compiler โ Java, Spring Boot, Python, and Qiskit.
PlankDB combines a classical in-memory key-value API with Grover-based quantum search experiments. v0.2.0 adds an independent Quantum Oracle Index extension that compiles Boolean predicates directly into reversible phase-oracle circuits for local Qiskit Aer simulation, without first enumerating matching states. The existing Java, REST, and legacy LOCAL/IBM interfaces are preserved.
v0.2.0 Release ยท Run the Oracle Lab ยท Research documentation ยท Source and benchmarks
The new execution path is Predicate AST โ algebraic simplification โ reversible phase oracle โ Grover / Aer โ classical verification. It supports EQUALS, BITMASK_EQUALS, AND, and OR over a bounded virtual integer register (2โ8 search qubits, up to 16 total qubits).
The compiler performs cost-guided circuit synthesis: it simplifies Boolean constraints, uses direct phase marking where appropriate, shares subexpressions in a reversible DAG, and rejects transformations estimated to increase CX-gate cost. Compound predicates use compute/phase/uncompute to restore work qubits. Reusable QPY circuit templates are cached with versioned identities, integrity checks, locking, and bounded resources.
For the reference predicate (x & 15) == 9 on 4 search qubits, 3 Grover iterations, 1,024 shots and seed 42 (Qiskit 1.1.1 / Aer 0.14.2, transpilation to u,cx, optimization level 1):
| Transpiled metric | Original compiler | Cost-guided compiler | Reduction |
|---|---|---|---|
| Oracle CX gates | 72 | 14 | 80.6% |
| Full Grover CX gates | 258 | 84 | 67.4% |
| Full Grover circuit depth | 455 | 158 | 65.3% |
| Total / work qubits | 5 / 1 | 4 / 0 | 1 fewer work qubit |
The audit includes 906 Aer pipeline samples and 600 cache samples with recorded negative results and resource limits. These improvements are relative to PlankDB's own original compiler, not a comparison with state-of-the-art external oracle compilers. The ideal Grover success probability is unchanged. No robust end-to-end latency improvement or database speedup has been demonstrated.
Scope: Quantum Oracle Index operates on a virtual bit-vector domain, not stored database records or QRAM. The new extension runs on a local CPU simulator; real quantum hardware was not used to validate these results. General
ORrequires manually selected Grover iterations. The legacyRANGEcorrectness defect remains documented and unchanged.
The implementation, mathematical assumptions, verification methodology, and reproducible measurements are documented separately:
| Document | What it contains |
|---|---|
| Mathematics and reversible compilation | Phase-oracle equations, Boolean simplification, ancilla cleanup, cost-guided synthesis, and Grover iteration selection. |
| Optimization results | Original vs optimized circuits, CX/depth measurements, timing breakdowns, and negative results. |
| Independent implementation audit | Adversarial statevector checks, Boolean predicate equivalence, cache integrity, and remaining limitations. This is a software audit, not external peer review. |
| Architecture and API | New execution path, domain/application/infrastructure/web boundaries, DSL, resource limits, and REST endpoints. |
| Reproducibility guide | Docker, dependencies, test commands, seeds, and benchmark reproduction. |
| Original experiment record | Historical pre-optimization baseline and initial local Aer results. |
| Raw benchmark evidence | Machine-readable experimental results; also see pipeline CSV and cache CSV. |
| Release validation | Executed Java/Python tests, Docker and HTTP smoke checks, repository hygiene, and known limitations. |
The project demonstrates a bounded, cost-aware compilation strategy; it does not claim a new quantum algorithm or establish novelty over prior oracle synthesis research.
Run the v0.2.0 demonstration with Docker (no IBM account, token, GPU, or paid quantum service required):
git clone https://github.com/swampus/plank-db.git
cd plank-db
cp .env.example .env
docker compose up --build -dOn PowerShell, use Copy-Item .env.example .env instead of cp. Do not overwrite an existing private .env or commit it. The supplied credential-free .env.example enables QUANTUM_ORACLE_ENABLED=true for the local demo.
- Oracle Lab: http://localhost:8085/oracle-lab/ โ interactive predicate explorer, real Aer measurements, circuit visualization, and recorded compiler comparisons.
- Swagger: http://localhost:8085/swagger-ui.html
- New endpoints:
POST /api/rest/v1/oracle/explainandPOST /api/rest/v1/oracle/search(additive; original collection endpoints remain available).
Example query for 4 bits, mask 15, target 9:
curl -sS -X POST http://localhost:8085/api/rest/v1/oracle/search \
-H 'Content-Type: application/json' \
-d '{"width":4,"predicate":{"type":"BITMASK_EQUALS","mask":15,"value":9},"iterations":3,"shots":1024,"seed":42}'Try iterations 0, 3, and 6 in the lab to see Grover amplitude amplification and overshooting. Simulation is probabilistic; the classical verifier independently checks measured states. The local Oracle feature is optional and disabled unless enabled in configuration. See the published v0.2.0 release and changelog for details.
- Quantum Oracle Index (v0.2.0)
- Research & Technical Documentation
- Try the Quantum Oracle Lab
- 1. Introduction
- 2. Project Overview
- 3. Project Run
- 4. Quickstart: Explain Quantum Plan (REST)
- 5. API Reference
- 6. Architecture and Code Structure
- 7. Quantum Search Theory and Practice
- 8. Limitations and Practical Considerations
- 9. License
PlankDB is an experimental quantum key-value database (search-oriented) implemented in Java, featuring a REST API for user interaction.
The main highlight of PlankDB is the integration of Java code with quantum search. When a search request is performed, PlankDB may invoke the Grover algorithm on a quantum emulator or on real quantum hardware (via IBM Qiskit Runtime).
PlankDB stores collections in a classical in-memory repository. Its legacy search ports can invoke Grover on encoded key sets; the Quantum Oracle Index provides a separate virtual bit-vector execution path. The project demonstrates these integrations without claiming to replace classical storage or its indexing costs.
| ๐ง Search Method | โฑ๏ธ Average Complexity |
|---|---|
HashMap (key-based) |
O(1) |
| Classical linear search | O(n) |
| Quantum search (Grover) | O(โn) |
Thus, PlankDB demonstrates the properties and limitations of applying Grover's quantum search algorithm to unstructured data.
The quantum entry in this table describes idealized oracle-query complexity. It excludes oracle construction, data encoding/loading, classical simulation and process/transport overhead; it is not a measured database runtime comparison.
Additionally, PlankDB showcases how classical programming environments (such as Java) may interact with quantum computing systems. In the near future, we may expect a variety of integration scenarios:
- Invoking quantum workloads through REST APIs in the cloud (as in this project);
- Direct connections to on-premises quantum hardware;
- Embedding provider-specific SDKs into mainstream languages (including JVM-based languages);
- Transparent switching to quantum mode triggered by data scale or query complexity.
PlankDB represents a prototype for what practical quantum search integration could look like, and it provides a starting point for the broader discussion about future standards of interoperability between classical and quantum computing platforms.
Docker is the recommended local deployment. Java and Python tests have also been executed on the host; exact environments and executed checks are recorded in the reproduction and release-validation documents.
git clone https://github.com/swampus/plank-db.git
cd plank-db
cp .env.example .env
docker compose build
docker compose upThis will launch the service and expose the API on port 8085.
๐ Alternatively, you can also use classic Docker CLI:
cp .env.example .env
docker build -t plankdb .
docker run --env-file .env -p 8085:8085 plankdbweb/โ Spring Boot REST API layerapplication/โ business logic layerdomain/โ core interfaces and modelsinfrastructure/โ integration services and runnerspython/โ Python scripts for both local simulation and IBM Quantum executiongrover.py,grover_range.pyโ for local backendgrover_ibm.py,grover_range_ibm.pyโ for IBM Quantum
To run PlankDB locally:
- Ensure you have Java 17+ and Python 3.10+ installed
- Install Qiskit in a virtual environment
- Run backend scripts from
scripts/folder manually if needed - Edit
application.ymlfor local configuration - Launch via
mvn spring-boot:run
Note: Quantum integration is triggered through subprocess-based execution of Qiskit scripts, and may require additional setup.
PlankDB supports execution on IBM's real quantum devices via IBM Quantum Runtime. To use this mode:
- Register at: https://quantum.ibm.com
- Generate your API token in your account settings
- Enable billing with a credit card (for real-device access)
- Set the following environment variables (or use the provided
.envfile):
export QUANTUM_EXECUTION_MODE=IBM
export QUANTUM_IBM_TOKEN=your_ibm_tokenThese variables allow switching between local simulation and IBM Quantum cloud execution. The values will be used automatically if placed in a .env file in the project root.
PlankDB exposes a RESTful HTTP API available on port 8085.
For full interactive documentation and testing, use the Swagger UI:
Key endpoints include:
POST /collections/{collection}/putโ insert a key-value pairGET /collections/{collection}/search/{key}โ perform Grover-based quantum search
Each endpoint is documented in the Swagger UI, including:
- request/response examples
- quantum-specific result fields like
confidence_scoreorexecution_time_ms - descriptions of fallback behavior if quantum execution is unavailable
This API is suitable for both classical usage and quantum-enabled applications.
To build and run PlankDB locally, you need the following installed:
- Java 17
- Apache Maven โ used for project compilation
- (Optional)
makeโ used as a shortcut for build commands
Note:
make buildwrapsmvn clean package -DskipTests; usemvn clean testto execute tests. The legacy Makefile has IBM-oriented environment defaults; use the LOCAL Docker setup above for the Oracle Lab.
PlankDB is designed to run smoothly with Docker Desktop and docker compose.
To get started:
docker compose up --buildThe project targets Java 17, which Docker builds and runs. Host tests were also executed with Java 21 using
release=17; this is not a compatibility claim for every newer JDK.
Once running, the API will be available at:
๐ http://localhost:8085/swagger-ui/index.html
For consistent behavior across platforms, we highly recommend using Docker Desktop โ it's free for personal and small business use.
๐ Note: On the first attempt,
docker compose up --buildmay fail due to Qiskit or network dependency issues.
Simply rerunning the command usually resolves it.
Local setup is possible but not officially supported or guaranteed to work reliably, due to differences in operating systems, Python environments, and quantum library configurations.
However, for users who wish to run PlankDB outside of Docker, here are the recommended steps:
-
Install Java 17
- Recommended via Adoptium
- Verify with:
java -version
-
Install Apache Maven
- Official site: https://maven.apache.org
- Verify with:
mvn -version
-
Clone the repository
git clone https://github.com/swampus/plank-db.git cd plank-db -
Build the project using Maven
mvn clean package
-
Run the application
java -jar web/target/plank-db.jar
To enable Grover-based quantum search locally:
-
Install Python 3.10+ and create a virtual environment
python -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows
-
Install Qiskit and dependencies
pip install -r requirements.txt
-
Set environment variables
- Export variables into the host process environment; Spring does not automatically load the Docker
.envfile for a host-launched JAR:QUANTUM_EXECUTION_MODE=LOCAL
- Export variables into the host process environment; Spring does not automatically load the Docker
-
Configure application settings
- Host execution needs the interpreter/script paths described in reproducibility. Configuration is in
web/src/main/resources/application.yml.
- Host execution needs the interpreter/script paths described in reproducibility. Configuration is in
โ ๏ธ Note: On some systems, Python subprocess handling or Qiskit versions may cause errors. This mode is best suited for development, debugging, or integration experimentation.
For most users, Docker remains the strongly preferred method for stability and reproducibility.
The Explain Quantum Plan endpoint builds a Grover search plan (key or range) and, for the local backend (Aer), performs a simulator dry-run to return measurement probabilities. On IBM, it returns the plan only (no dry-run) to keep the response fast and deterministic.
Swagger UI:
http://localhost:8085/swagger-ui.htmlA sample collectiontestis auto-created on startup with keysk1..k4.
docker build -t plankdb:latest .
docker run --rm -p 8085:8085 --env-file .env plankdb:latestcurl -s -X POST http://localhost:8085/api/rest/v1/collections/test/explain -H 'Content-Type: application/json' -d '{
"mode": "KEY",
"key": "k2",
"backend": "local",
"strategy": "AUTO",
"shots": 512,
"seed": 42
}' | jq .curl -s -X POST http://localhost:8085/api/rest/v1/collections/test/explain -H 'Content-Type: application/json' -d '{
"mode": "RANGE",
"fromKey": "k2",
"toKey": "k4",
"backend": "local",
"strategy": "AUTO"
}' | jq .curl -s -X POST http://localhost:8085/api/rest/v1/collections/test/explain -H 'Content-Type: application/json' -d '{"mode":"KEY","key":"k3","backend":"ibm"}' | jq .PlankDB can be configured via environment variables (recommended) or JVM props.
We ship a template: .env.example โ copy it to .env and tweak values:
cp .env.example .envPlankDB reads its config from environment variables. Template: .env.example.
| Variable | Default | Description |
|---|---|---|
SERVER_PORT |
8085 |
HTTP port |
SPRING_PROFILES_ACTIVE |
default |
Spring profile (default, dev, prod) |
LOG_LEVEL |
INFO |
Root logging level |
QUANTUM_EXECUTION_MODE |
LOCAL |
LOCAL (Aer) or IBM / IBM_REAL_PC |
QUANTUM_PYTHON_EXEC |
/opt/venv/bin/python |
Python interpreter for Qiskit scripts |
QUANTUM_EXPLAIN_SHOTS |
2048 |
Default shots for Explain dry-run |
QUANTUM_EXPLAIN_SEED |
42 |
Default simulator seed |
IBM_QUANTUM_API_TOKEN |
โ | (IBM only) API token |
IBM_QUANTUM_BACKEND |
โ | (IBM only) e.g. ibm_nairobi |
.env.example (snippet):
SERVER_PORT=8085
SPRING_PROFILES_ACTIVE=default
LOG_LEVEL=INFO
QUANTUM_EXECUTION_MODE=LOCAL
QUANTUM_PYTHON_EXEC=/opt/venv/bin/python
QUANTUM_EXPLAIN_SHOTS=2048
QUANTUM_EXPLAIN_SEED=42
# IBM (optional)
# IBM_QUANTUM_API_TOKEN=
# IBM_QUANTUM_BACKEND=ibm_nairobiBuilds an explainable Grover plan.
- If
backend=local, also runs a simulator dry-run (Aer) and returns probabilities. - If
backend=ibm, returns plan only;dryRunisnull.
{
"mode": "KEY | RANGE",
"key": "k2",
"fromKey": "k2",
"toKey": "k4",
"backend": "local | ibm",
"strategy": "AUTO | FIXED",
"iterations": 2,
"shots": 2048,
"seed": 42
}Fields
mode(required):KEYorRANGE.key: required whenmode=KEY.fromKey,toKey: optional bounds whenmode=RANGE(lexicographic).backend:local(default) oribm.strategy:AUTO(default) computesfloor(ฯ/4 * sqrt(N/M));FIXEDusesiterations.iterations: used only whenstrategy=FIXED(min 1).shots,seed: optional simulator parameters for local dry-run.
{
"plan": {
"mode": "KEY",
"targetLabel": "k2",
"encodingMap": { "k1": "00", "k2": "01", "k3": "10", "k4": "11" },
"markedStates": ["01"],
"estimatedM": 1,
"collectionSizeN": 4,
"numQubits": 2,
"optimalIterations": 1,
"iterationsUsed": 1,
"oracleExpression": "(x01)",
"estimatedOracleDepth": 4,
"estimatedGateCounts": { "h": 4, "x": 2, "mcx": 1 },
"backend": {
"name": "local/aer_simulator",
"shots": 512,
"seed": 42,
"noiseModel": false
},
"notes": [
"Grover ~โ(N/M); AUTO uses floor(ฯ/4 * sqrt(N/M)).",
"Diffusion amplifies the marked states after the oracle phase flip.",
"Depth/gate counts are coarse estimates; actual values depend on oracle synthesis."
]
},
"dryRun": {
"topMeasurement": "01",
"probabilities": { "01": 0.86, "11": 0.14 },
"confidenceScore": 0.86,
"executionTimeMs": 12
}
}On IBM,
dryRunisnull.
400โ invalid input (e.g., missingmode/key, malformed range)404โ collection/key/range not found502โ simulator/backend error during dry-run
- Encoding is lexicographic over the current set of keys; changing keys changes the
encodingMap. optimalIterationsdepends on collection sizeNand number of marked statesM.- Dry-run probabilities are stochastic; use
seedfor reproducibility.
PlankDB follows the principles of Clean Architecture, promoting clear separation of concerns and independence between layers. This structure improves testability, modularity, and long-term maintainability โ essential qualities for both experimental and production-grade systems.
The project is organized into the following core packages:
-
domain/
Defines core domain interfaces and abstract models.
It is independent of frameworks and contains no external dependencies. -
application/
Contains use cases that encapsulate the business logic of the system.
These use cases coordinate domain interfaces and serve as the heart of the application logic. -
infrastructure/
Implements interaction with external systems such as Python quantum scripts, file runners, and environment configuration.
This layer acts as the adapter between the core logic and the outside world. -
web/
Provides the REST API using Spring Boot.
It exposes endpoints for interacting with collections, performing quantum and range queries, and integrates with the application layer via dependency injection. -
python/
Contains executable Python scripts that implement Groverโs algorithm for both local and IBM Quantum backends.
These scripts are invoked by the infrastructure layer and return quantum search results back to the application.
This approach is chosen because it:
- Enables isolated testing of logic without reliance on HTTP or Python dependencies
- Makes it easy to swap or extend quantum execution backends (e.g., simulator vs. real hardware)
- Encourages long-term separation of interface and implementation
- Supports both demonstration and research-level experimentation
The modular layout ensures that PlankDB remains flexible and maintainable, even as quantum technologies evolve.
PlankDB adheres to the Dependency Inversion Principle (DIP) โ a core part of Clean Architecture โ by organizing dependencies around abstractions:
- The
application/anddomain/layers depend only on interfaces, never on concrete implementations. - Quantum execution interfaces are declared in the domain layer, while real implementations (e.g. Python script runners) reside in
infrastructure/. - The REST API in
web/interacts only with the application layer, unaware of how quantum execution is actually performed.
This design makes it easy to:
- Swap quantum backends (e.g., switch from local simulation to IBM hardware)
- Test the application logic in isolation (using mocks or stubs)
- Maintain long-term separation between business logic and technical concerns
By inverting dependencies and structuring around use cases, PlankDB remains flexible, extendable, and robust against changes in technology or platform.
๐ Expand subsections
At the heart of quantum computing lies the concept of superposition โ a fundamental difference from classical computation.
In classical systems, a bit can be either 0 or 1.
In quantum systems, a qubit can be in a superposition of both |0โฉ and |1โฉ states simultaneously:
|ฯโฉ = ฮฑ|0โฉ + ฮฒ|1โฉ
Where:
ฮฑandฮฒare complex amplitudes,- |ฮฑ|ยฒ + |ฮฒ|ยฒ = 1,
- The square of the amplitude gives the probability of observing that state upon measurement.
When you measure the qubit, the superposition collapses into either 0 or 1 โ but until measurement, the system evolves as a combination of both.
In multi-qubit systems, superposition enables a system of n qubits to represent 2โฟ possible states simultaneously.
This exponential parallelism is what makes quantum algorithms โ like Groverโs โ so powerful.
For example, with 5 qubits we can simultaneously explore 32 different states.
This is not parallel computing in the classical sense โ rather, itโs a probabilistic amplitude evolution governed by linear algebra over Hilbert space.
In PlankDB, this principle is simulated by running Groverโs algorithm over a space of binary-encoded keys.
Each possible key is mapped to a quantum state in superposition, and the oracle function is used to mark the correct state, increasing its measurement probability.
Grover's algorithm allows searching an unsorted list of N items in approximately โN steps โ a quadratic speedup over classical search.
Key steps:
- Initialization โ Create an equal superposition over all states
- Oracle โ Mark the correct state by inverting its amplitude
- Diffusion operator โ Reflect the state vector around the average
- Repeat โ Run this process โN times
The amplitude of the marked state increases with each iteration.
After a few iterations, a measurement is likely to return the correct state.
This algorithm is implemented using Qiskit circuits โ either locally (Aer simulator) or remotely (IBM Quantum Runtime).
In PlankDB, both search and range operations rely on Grover's algorithm:
- A collection of keys is loaded into a Python script and encoded as binary
- An oracle circuit is constructed based on the key or range condition
- Grover's algorithm is run to amplify the matching state
- The result is decoded and returned to the Java API
This is not efficient for production โ O(n) time to prepare the state โ but is ideal for demonstration purposes.
Quantum search results are inherently probabilistic โ a correct answer is likely, but not guaranteed.
PlankDB returns a rich result object:
{
"quantum_result": {
"matched_key": "0101",
"matched_value": "example",
"matched_index": 5,
"top_measurement": "0101",
"oracle_expression": "key == 0101",
"num_qubits": 4,
"confidence_score": 0.91,
"execution_time_ms": 84,
"oracle_depth": 8,
"iterations": 3
},
"scientific_notes": {
"principle": "Grover amplification",
"theory": "oracle-based selection in Hilbert space",
"circuit_behavior": "amplitude modulation",
"confidence_interpretation": "non-deterministic probability outcome",
"qubit_commentary": "n qubits encode 2^n states",
"encoding_map": {
"0000": "a",
"0001": "b"
},
"used_iterations": 3
}
}This DTO (QuantumResultDTO) includes both raw results and scientific context for interpretability.
Grover's algorithm provides meaningful advantage when:
- The dataset is large (thousands to millions of records)
- Search is performed repeatedly over static data
- Quantum memory (QRAM) becomes practical
Today, these conditions are not met โ data loading is classical and overhead is high.
However, PlankDB provides a useful demonstration of how such systems could work โ and what real-world Javaโquantum integration might eventually look like.
| Field | Description |
|---|---|
matched_key |
The key found by quantum search (in binary or text form) |
matched_value |
The value associated with that key |
matched_index |
Index in the list of all inputs |
top_measurement |
Most frequently observed measurement state |
oracle_expression |
Oracle logic used in Grover (e.g., "key == 1010") |
num_qubits |
Number of qubits used for the search |
confidence_score |
Probability of correctness (0.0 โ 1.0) |
execution_time_ms |
Time spent in script execution |
oracle_depth |
Logical circuit depth of the oracle |
iterations |
Number of Grover iterations performed |
And:
Field (scientific_notes) |
Description |
|---|---|
principle |
Algorithmic principle (e.g., Grover amplification) |
theory |
Scientific explanation (e.g., amplitude evolution) |
circuit_behavior |
Summary of what the circuit does |
confidence_interpretation |
Notes on how to interpret probabilistic output |
qubit_commentary |
Explanation of how the number of qubits relates to space |
encoding_map |
Mapping of binary strings to original keys |
used_iterations |
How many iterations were used in this run |
q_0: โโโHโโโโโโโโXโโโHโโโM
| |
q_1: โโโHโโโโโโโโXโโโHโโโM
Oracle Diffusion
- H: Hadamard gate (superposition)
- โ: Controlled oracle marking
- X + H: Inversion around average (diffusion)
- M: Measurement
- Grover, L. K. (1996). A fast quantum mechanical algorithm for database search.
โก๏ธ https://arxiv.org/abs/quant-ph/9605043 - Nielsen & Chuang. Quantum Computation and Quantum Information
- Qiskit Grover API: https://qiskit.org/documentation/stubs/qiskit.algorithms.Grover.html
- IBM Quantum Runtime: https://docs.quantum.ibm.com/run
What the plan contains ๐ฆ
The Explain endpoint returns a deterministic description of a Grover search before (and optionally alongside) any execution:
- Lexicographic encodingMap (key โ fixed-width bitstring) ๐บ๏ธ
- markedStates (bitstrings for the key/range) ๐ฏ
- numQubits ๐ข and human-readable oracleExpression ๐งพ
- optimalIterations
k โ floor(ฯ/4 ยท โ(N/M))(AUTO) or user-provided FIXED value ๐งญ - Coarse gate/depth estimates (heuristics) ๐
- Backend metadata (local Aer vs. IBM Runtime) ๐งฉ
Why itโs useful ๐ก
- Makes the algorithm transparent (what is encoded, what is marked, how many iterations) ๐ฆ
- Ensures reproducibility (same inputs โ same plan) ๐
- Enables fast local validation via dry-run (Aer) to visualize probability amplification ๐
How to read the dry-run ๐งช
topMeasurementโ most probable bitstring;confidenceScoreโ its probability โ- With multiple marked states (range), probability mass splits across them
โ๏ธ - Under-rotation (too few iterations) โ flatter histogram; over-rotation can shift mass away โ expected in Grover ๐
Oracle notes ๐งฐ
Bitstrings are marked by a phase oracle (multi-controlled Z) synthesized as H โข MCX โข H on the last qubit, with X pre/post around zero-bits to match the pattern. Depth and gate counts depend on decomposition (device topology, transpiler), so estimates are intentionally coarse.
Limitations
- Building the encodingMap is classical O(N) ๐ข
- Gate/depth metrics are heuristics; real circuits vary with synthesis ๐งฎ
- Dry-run is local and noise-free; on IBM the endpoint returns plan only to avoid queue time and hardware noise ๐ซ๐ฐ๏ธ
While PlankDB demonstrates the principles of quantum search in a practical Java-based application, it is subject to several real-world limitations that must be considered.
- PlankDB is a prototype โ designed for learning, demonstration, and experimentation
- The system is not optimized for performance or concurrency
- It does not persist data beyond runtime (in-memory only)
- No authentication, rate limiting, or production deployment support is included
Although Groverโs algorithm runs in O(โn) time, preparing the data for quantum execution still requires:
- O(n) time to load the collection into memory
- Binary encoding and serialization of keys to pass to the Python script
- Subprocess overhead for spawning Python (especially on Windows) These factors negate the quantum speedup for small or medium-sized datasets.
- IBM Quantum has limited availability, even with billing
- Circuit depth, qubit decoherence, and queue time significantly affect results
- Noise can corrupt outputs unless error mitigation is applied For these reasons, PlankDB primarily runs on local simulation (Qiskit Aer) during development.
Quantum results are non-deterministic:
- A query may return the wrong key with small probability
- The legacy
confidence_scorereports a measurement-derived score, not a calibrated probability that the returned answer is correct - Repeated runs improve reliability but increase cost on real quantum hardware
An ideal Grover oracle-query advantage depends on efficient oracle access; it is not an observed PlankDB database speedup:
| Factor | Classical Search | Quantum Grover |
|---|---|---|
| Large unstructured spaces with efficient oracle access | Classical cost depends on the chosen index and data layout | Ideal Grover uses O(โN) oracle queries, excluding preparation and execution overhead |
| Small collections | Usually very fast | Simulator and circuit overhead generally dominate |
| Repeated queries on static data | Classical indexes can be reused | Reusing compiled oracle templates saves compilation work, not quantum execution cost |
| Fast, deterministic responses | Usually preferable | Sampling and external execution add latency and uncertainty |
As quantum hardware matures and QRAM becomes available, systems like PlankDB could:
- Eliminate the O(n) classical loading bottleneck
- Perform batch queries and filtering entirely in quantum space
- Integrate deeper with Java or Kotlin through native quantum SDKs
Until then, PlankDB remains a valuable educational and architectural prototype for quantum-enhanced search systems.
This project is licensed under the MIT License โ a permissive open-source license.
You are free to use, modify, and distribute the code for both commercial and non-commercial purposes, provided that the original copyright notice is included.
๐ Full license text is available at:
โก๏ธ LICENSE
Contributions, issues, and feature requests are welcome!
If youโd like to help improve PlankDB:
- Fork the repository
- Create a new branch
git checkout -b feature/your-feature