AI & Artificial Intelligence
Explore AI foundations, generative models, agents, developer tools, and responsible use.
LinkSpot Knowledge
Explore AI foundations, generative models, agents, developer tools, and responsible use.
Learn programming fundamentals, languages, web and mobile development, databases, testing, and architecture.
Explore cloud platforms, Linux operations, containers, DevOps, and networking.
Learn practical web and network security, identity, privacy, and security operations.
Explore data engineering, SQL, analytics, visualization, and data quality.
Explore PCs, semiconductors, mobile devices, IoT, robotics, and open web standards.
Discover developer, collaboration, and design tools plus no-code and low-code workflows.
LinkSpot Knowledge
Explore practical guides and knowledge by category.
1,879 articles
A deadlock is a cycle in which two or more transactions wait for locks held by one another, so none can proceed. Unlike ordinary lock contention, waiting alone cannot resolve a cycle. PostgreSQL detects the cycle, cancels one involved transaction, and lets the others continue. An application must be able to retry the canceled transaction safely.
A lock coordinates access when transactions or administrative tasks touch the same data. Databases automatically take the locks needed for commands such as `UPDATE` and `DELETE`; an application can also request a row lock when it must keep another request from changing a value between checking it and acting on it. Locks reduce some concurrency problems but can create waits and deadlocks, so protect only the needed scope and keep the transaction short.
An isolation level defines when concurrent transactions can see one another’s changes and how the database handles conflicting work. A lower level can handle many common operations simply, but some query results may change during a transaction. A stronger level offers stricter guarantees and may require transaction retries. In PostgreSQL 18, the default `READ COMMITTED` is sufficient for many tasks, while work that reads several rows and checks a business rule may need additional protection.
ACID is an acronym for four properties of database transactions: atomicity, consistency, isolation, and durability. Together, they help treat related changes as one reliable operation, but a database cannot automatically enforce business rules that have never been defined. In a PostgreSQL account transfer, for example, the related changes must commit or roll back together, valid balance rules must be expressed, concurrent work must be controlled, and a confirmed commit must survive failures.
A database transaction groups related SQL operations into one logical unit. The database either commits the complete group or, after a failure, discards its changes so that only part of the operation is not left behind. In PostgreSQL, use `BEGIN` to start an explicit transaction, `COMMIT` to make it final, or `ROLLBACK` to cancel it. A transaction defines the boundary for a group of changes; what concurrent transactions can see is also affected by separate settings such as the isolation level.
A query planner decides how a database will read and combine data for a SQL statement. The same SQL may use a sequential scan, an index scan, or a different join strategy depending on table size, value distribution, indexes, statistics, and settings. In PostgreSQL, `EXPLAIN` shows the selected plan; refreshed statistics can improve the estimates behind that choice. Plan cost is not elapsed time, and `EXPLAIN ANALYZE` actually executes the statement.
A hash index computes a hash value from a column value and uses it to find a bucket of candidates for an `=` lookup. PostgreSQL’s hash index stores only a 32-bit hash code, so it can be smaller than a B-tree for long values, but that does not guarantee better speed or suitability. It cannot serve range searches, ordering, or uniqueness checks, and bucket overflow and growth behavior also matter.
A B-tree index stores values in an ordered search structure so a database can find rows by equality or range conditions. It is PostgreSQL’s default index type and can also supply rows in an order that matches `ORDER BY`. An index is not automatically used by every query. Choose it for actual filtering and ordering patterns, then review the execution plan and the cost of maintaining it.
A database index is a separately maintained search structure that helps a database find rows matching a condition. Like the index at the back of a book, it can point toward candidate locations instead of requiring a scan of all the data. But an index consumes storage and must be updated when rows change. Choose indexes for real query and write patterns, then inspect query plans to see whether they help.
A foreign key is a database constraint that requires values in one table to refer to existing key values in another table. For example, it can prevent an order’s `customer_id` from pointing to a customer that does not exist, preserving referential integrity. If the referencing column allows NULL, a row with no value can normally bypass the reference check, so design whether the relationship is required or optional.
A primary key is a column or combination of columns designated to identify each row in a table uniquely. Its constraint disallows duplicate and NULL key values, giving queries, updates, deletes, and references from other tables a stable target. An automatically increasing number is not a primary key just because it increases; the constraint must enforce uniqueness.
A database column is a named part of a table that holds values of the same kind for each row. For example, a `quantity` column stores the quantity for each order item. Good column design specifies more than a name: its data type, whether it may be absent, and whether values may repeat all affect the meaning and quality of the data.
A database row is one record in a table: one set of values describing an item such as a customer or an order. Its columns hold that record’s attributes. A row does not automatically have a unique identity or a guaranteed position, so use a key to target it and an explicit sort condition when order matters.
A table in a relational database is a basic structure for storing items of the same kind in rows and columns. Columns define each item’s attributes and data types; each row represents one item. Unlike a spreadsheet, a table does not guarantee the displayed order of rows, and keys and constraints are needed to prevent unwanted duplicates or invalid values.
A database schema is a definition of how a database organizes and relates data. It commonly includes tables, column types, keys and constraints, relationships, and objects such as indexes and views. The term varies by context: it can mean the overall structure, or—as in PostgreSQL—a named namespace inside one database. Keep those meanings distinct when reading documentation.
An in-memory database keeps its primary working copy of data in RAM and processes reads and writes there. Memory access can reduce storage I/O and help achieve low latency, but RAM capacity and cost are constraints, and preserving data through failures requires a separate durability and recovery design. “In-memory” therefore does not by itself mean volatile, nor does it mean data is automatically safe.
A vector database stores numeric arrays called embeddings and ranks items by how close their vectors are. It can find documents with similar meaning even when they use different words, or retrieve similar images and other unstructured content. Similarity is not correctness or proof of fact, however, so design keyword and metadata conditions and result review alongside vector search.
A time-series database is a database or storage design suited to continuously recording measurements tied to time and querying trends, anomalies, or summaries over time ranges. Typical data includes server metrics, sensor readings, heart rate, and prices—repeated observations of a subject over time. A timestamp column alone does not require a separate time-series database; compare write volume, query patterns, retention needs, and your existing system.
A graph database stores entities and their relationships as central parts of its data model, so queries can follow links to find connected things. If your main question involves several steps—such as person, account, and device—you can represent which nodes connect and through which relationships. “Graph database” does not name one product or one data model, however; distinguish implementations such as property graphs and RDF.
A wide-column database is a distributed data model that organizes data around row keys and allows different rows to contain different columns. In Apache HBase, sparse columns are grouped into column families and qualifiers; in Cassandra, partition keys and clustering columns determine which rows are grouped and how they are ordered. “Column” here does not mean the same thing as a columnar analytics engine, so keep these models distinct.