Topics (384k) Articles (398k) Users (410) Discussions (242) Comments (383) Files (13k) New article
A materialized view stores the result of a defining database query, allowing later queries to read the stored result. An ordinary database view retains the definition and evaluates it against the relevant underlying data when queried. A materialized view trades storage and maintenance work for potentially cheaper repeated reads; its freshness depends on when and how the result is maintained.[ref]
Materialized Views in the PostgreSQL documentation. §39.3, opening comparison of CREATE MATERIALIZED VIEW and CREATE TABLE AS, persisted results and refresh
Suppose an orders table contains totals 10 and 20 for one customer. A materialized view defined by
SELECT customer_id, SUM(total) AS total FROM orders GROUP BY customer_id stores 30 for that customer. Inserting a third order worth 7 changes the underlying sum to 37. In PostgreSQL, the previously stored 30 remains until a refresh replaces the result, for example with REFRESH MATERIALIZED VIEW customer_totals;. The stored answer can therefore be internally consistent yet out of date.A dashboard that tolerates nightly updates can benefit from this arrangement, especially when the defining database query combines many rows. An application requiring the latest committed totals needs a suitable maintenance policy and database transaction semantics. The term materialized view alone does not promise automatic updates or an always faster query.[ref]
Materialized Views in the PostgreSQL documentation. §39.3, sales_summary example and nightly REFRESH MATERIALIZED VIEW
Transaction atomicity gives a database transaction an all-or-nothing effect: either its committed updates take effect together or its partial updates do not remain as a completed result. This can be implemented with undo information, version visibility, recovery logging or combinations of these mechanisms. It does not require every physical write to happen at the same instant.
For example, transferring five units between accounts requires a debit and a credit. If an error occurs after the debit, aborting the transaction must not leave only that debit as the final database result. SQL transaction blocks use
BEGIN, COMMIT and ROLLBACK to express the boundary.[ref] Atomicity alone does not say how transactions interact before completion; transaction isolation governs that. Nor does it make a committed result survive a crash; that is transaction durability. External effects such as a sent email require coordination beyond rolling back the database changes.Transaction durability means that an acknowledged committed transaction survives failures covered by the database's durability model. A successful statement that has not committed is not yet such a promise. The failure model and storage configuration matter: surviving a process crash does not automatically mean surviving destruction of every storage replica.
Write-ahead logging provides one mechanism. Before reporting a durable commit, persist the required log records. Modified data pages can be written later because recovery can replay their committed changes from the log. The log-before-data rule also prevents a page from reaching persistent storage without the recovery information needed to interpret it.[ref]
Write-Ahead Logging in the PostgreSQL documentation. §28.3, WAL ordering and REDO
Durability therefore concerns persistence of the committed result, whereas transaction atomicity concerns which parts of a transaction may take effect. Faster asynchronous commit settings can deliberately weaken the interval covered by the acknowledgment.Transaction isolation specifies which effects concurrent database transactions may observe and which interleavings are permitted to commit. Serializable isolation requires the combined result to be equivalent to some serial ordering, even when execution actually overlaps. Weaker levels admit particular anomalies; their names require implementation-specific interpretation.[ref]
For example, two doctors are on call. Each transaction reads that both are available and removes its own doctor, intending to leave someone on call. If each sees an old snapshot and they update different rows, both may commit under a snapshot-based level that does not prevent this write skew. No serial ordering would let both checks pass. PostgreSQL Serializable can reject such conflicting executions, so the application must be prepared to retry a whole transaction. Isolation protects a stated concurrency model; it does not repair a faulty business rule within one transaction.
Database query processing is the sequence that turns a database query into returned results. In a typical SQL system, it includes parsing the text, checking names and types, rewriting the query when appropriate, database query optimization, and executing the chosen database query plan. Planning chooses operations; execution actually performs storage accesses, relational joins, filtering and aggregation.[ref]
For a request for each customer's total order value, the engine might scan orders, group their database tuples by customer identifier, sum the values and return one result per customer. An alternative plan can first restrict the orders using a database index. The result specification alone does not prescribe which access method performs the work.
A query against a stored database view illustrates why processing has more than a text-to-loop step. PostgreSQL can rewrite the reference into a query on the underlying tables before planning. The executor then walks the resulting plan and obtains rows from its operations. The distinction is useful when diagnosing a slow query: excessive planning work, a poor plan, and unexpectedly expensive execution are different causes even if the same statement triggered them.[ref]
Database query optimization chooses a database query plan for a database query by comparing ways to obtain the required result. The choice includes the order of relational joins, use of a database index, and the algorithms implementing those relational joins. A cost model estimates work from quantities such as input sizes and storage accesses. The selected plan minimizes estimated cost among considered alternatives; this need not be the fastest possible plan in reality.[ref]
Planner and Optimizer in the PostgreSQL documentation. Section 51.5, opening paragraphs and Generating Possible Plans
Consider a relational join of one million orders with customers, followed by a condition selecting ten customers. Applying the customer condition first can greatly shrink a join input. If a suitable database index locates those customers' orders, the engine may avoid scanning all orders. If almost all customers qualify, a sequential scan can instead be cheaper than many scattered index accesses. These are alternative ways of computing the same answer, not different meanings of the query.
Join order also matters with three or more inputs: an early join that creates a huge intermediate result can dominate the total work. Exhaustive search itself becomes expensive as the number of inputs grows. PostgreSQL therefore switches to a heuristic search above a configurable threshold. Inaccurate size estimates can favor a poor plan even when the search algorithm correctly minimizes its cost model.[ref]
Planner and Optimizer in the PostgreSQL documentation. Section 51.5.1, scan alternatives, join sequences and heuristic search
PostgreSQL is an open-source object-relational database management system supporting SQL, database transactions, constraints and extensible data types. It manages stored relations and concurrent access through a server, rather than merely defining a database query language. The project descends from the Berkeley POSTGRES system.[ref]
What Is PostgreSQL? in the PostgreSQL documentation. Preface §1, origins and supported features
For example,
SELECT name FROM samples WHERE reading > 5 requests selected rows without prescribing their physical access path. A database index can accelerate retrieval, while database transactions govern the visibility and consistency of related updates. A database relation has no implicit presentation order: a caller needing sorted rows must request an ordering.[ref]Concepts in the PostgreSQL documentation. §2.2, relations, columns and unspecified row order
These distinctions separate logical results from storage organization and display.A database index is an auxiliary data structure that helps a database management system locate records satisfying selected conditions. It stores information organized for an access pattern, such as searching a column value, without requiring every database tuple to be inspected. The database query still specifies the result; the index supplies a possible route to it.[ref]
Introduction to Indexes in the PostgreSQL documentation. §11.1, indexed lookup example and maintenance costs
For example, a database relation with a million samples can have an index on
sample_id. Looking for one identifier can follow a search structure instead of scanning all rows. A condition matching most rows may still favor a scan, since many separate lookups and row fetches can cost more. The index occupies storage and must be maintained on relevant updates. These costs explain why indexing every column is not automatically the best design.Sanitization verification checks the outcome of an attempted data sanitization operation: whether the technique completed, and whether its result shows errors or anomalies. In the NIST terminology, this is distinct from sanitization validation, which decides whether the outcome adequately protects the target data.[ref]
Guidelines for Media Sanitization by Ramaswamy Chandramouli and Eric A. Hibbard. Section4.5.1, printedp.24, outcome inspection and completion evidence
The evidence depends on the technique and medium. It may include a tool's completion status, device-health information or inspection of the remnants of a destructive process. A successful status message concerns the operation that was actually attempted; it does not establish that the chosen technique was appropriate.[ref]
For an original accounting example,20 devices enter an assessment. Nineteen report successful completion and one reports an error. The completion fraction is . That figure is not a95-percent probability that every device is sanitized, nor does it show that each of the19 successful outcomes meets the intended protection objective.
Sanitization validation decides whether a data sanitization outcome is adequate for its intended data-protection objective. It considers the evidence from sanitization verification, the suitability of the method and any relevant errors or anomalies. The result is an acceptance or rejection of the sanitization claim.[ref]
Guidelines for Media Sanitization by Ramaswamy Chandramouli and Eric A. Hibbard. Section4.5.2, printedpp.24–25, adequacy decision
For an original distinction, suppose a device reports that its selected operation completed successfully, but the method was not suitable for the stipulated recovery capability against which the data was meant to be protected. The operation can have passed its completion check while the sanitization claim is rejected. This is a mismatch between a successful operation and an inadequate objective, not a contradiction between the two assessments.
An invented batch example makes the denominator explicit. Of20 outcomes,19 have successful completion evidence. Of those19, only15 also satisfy the stipulated adequacy criteria. The accepted fraction is then of the batch, or of the successfully completed operations. Reporting only would answer the verification question while leaving the validation question unresolved.
The scope remains the specified target data on the specified medium. A decision about one device does not establish that a separate backup or another copy of the same information has also been sanitized. Validation connects the observed evidence to a bounded protection claim.
Pinned article: Introduction to the OurBigBook Project
Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
Intro to OurBigBook
. Source. We have two killer features:
- topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculusArticles of different users are sorted by upvote within each article page. This feature is a bit like:
- a Wikipedia where each user can have their own version of each article
- a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.Figure 1. Screenshot of the "Derivative" topic page. View it live at: ourbigbook.com/go/topic/derivativeVideo 2. OurBigBook Web topics demo. Source. - local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
- to OurBigBook.com to get awesome multi-user features like topics and likes
- as HTML files to a static website, which you can host yourself for free on many external providers like GitHub Pages, and remain in full control
Figure 2. You can publish local OurBigBook lightweight markup files to either OurBigBook.com or as a static website.Figure 3. Visual Studio Code extension installation.Figure 5. . You can also edit articles on the Web editor without installing anything locally. Video 3. Edit locally and publish demo. Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension. - Infinitely deep tables of contents:
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact





