Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Indexes

Front

What does setting auto-commit to false in JDBC transactions do?

Disables automatic commit of individual SQL statements. With auto-commit disabled, a transaction isn't finalized until explicitly committed. This…

View Card →
Flashcard Study

Java: Indexes

Front

Why use PreparedStatements over Statements in JDBC?

PreparedStatements prevent SQL injection and improve performance. PreparedStatements pre-compile SQL queries, allowing safer execution and reuse. They're safer…

View Card →
Flashcard Study

Java: Indexes

Front

What signifies inefficient index usage in an execution plan?

Full table scans despite available indexes indicate inefficiency. If a query execution plan shows full table scans where…

View Card →
Flashcard Study

Java: Indexes

Front

How can you improve write performance affected by indexes?

Consider dropping non-essential indexes during bulk writes. If write performance is critical, temporarily dropping indexes before bulk operations…

View Card →
Flashcard Study

Java: Indexes

Front

When should you avoid creating an index, considering table size?

Avoid indexes on small tables as they offer little performance gain. Small tables can be scanned quickly; thus,…

View Card →
Flashcard Study

Java: Indexes

Front

How does JDBC execute a static SQL query?

JDBC uses a Statement object to execute static SQL queries. The Statement object allows SQL commands to be…

View Card →
Flashcard Study

Java: Indexes

Front

Why might you avoid using indexes on columns with unique values?

Indexes offer little benefit on unique-value columns. If a column's values are unique, like a primary key, each…

View Card →
Flashcard Study

Java: Indexes

Front

How can you inspect the execution plan of a SQL query?

Use the EXPLAIN statement before your SQL query. EXPLAIN provides insights into how a database executes a query,…

View Card →
Flashcard Study

Java: Indexes

Front

How would you explain a trade-off of using indexes in a database in an interview?

Indexes can slow down write operations like INSERT and UPDATE. While indexes speed up data retrieval, they require…

View Card →
Flashcard Study

Java: Indexes

Front

How would you explain a common use case for indexes in SQL databases in an interview?

Indexes are often used on columns that are frequently searched. If a column is regularly used in WHERE…

View Card →