<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – Transaction</title>
    <link>https://www.devkuma.com/en/tags/transaction/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/transaction/logo/180x180.jpg</url>
      <title>Transaction</title>
      <link>https://www.devkuma.com/en/tags/transaction/</link>
    </image>
    <description>Recent content in Transaction on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/transaction/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Database Index</title>
      <link>https://www.devkuma.com/en/docs/rdbms/index/</link>
      <pubDate>Sun, 19 Dec 2021 01:05:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/rdbms/index/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-an-index&#34;&gt;What Is an Index?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;An index is a data structure that increases the speed of operations on a table.&lt;/li&gt;
&lt;li&gt;An index can be created by using one column or multiple columns in a table.&lt;/li&gt;
&lt;li&gt;It provides the basis not only for fast search operations but also for efficient ordering related to record access.&lt;/li&gt;
&lt;li&gt;An index is a data structure that improves search speed in a database table by using additional write operations and storage space.&lt;/li&gt;
&lt;li&gt;If we want to find specific content in a book, searching every page takes a long time. For that reason, authors add an index at the front or back of a book, and a database index is like a book index.&lt;/li&gt;
&lt;li&gt;In databases as well, searching all data in a table takes a long time, so a data structure containing data and the location of the data is created to support fast lookups.&lt;/li&gt;
&lt;li&gt;If you query a column without an index, a Full Scan that searches the entire table is performed. Full Scan compares and searches the whole table, so it is slow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;two-ways-to-search-data-in-a-database&#34;&gt;Two Ways to Search Data in a Database&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;FTS(Full Table Scan)
&lt;ul&gt;
&lt;li&gt;A method that searches a table from beginning to end.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Index Scan
&lt;ul&gt;
&lt;li&gt;A method that searches an index and accesses the table for the corresponding data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;index-data-structures&#34;&gt;Index Data Structures&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Hash table&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Implements an index based on a hash generated from column values.&lt;/li&gt;
&lt;li&gt;Search is very fast because the time complexity is O(1).&lt;/li&gt;
&lt;li&gt;Sequential search for continuous data, such as inequalities (&amp;lt;, &amp;gt;), is not possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;B+Tree&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A data structure that improves a B-Tree, where each node has two or more child nodes.&lt;/li&gt;
&lt;li&gt;It makes sequential search easier by connecting the leaf nodes of a BTree with a LinkedList.&lt;/li&gt;
&lt;li&gt;Although it has worse time complexity, O(log2n), than a hash table, it is used more commonly than hash tables.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>RDBMS</category>
      
      <category>Transaction</category>
      
    </item>
    
    <item>
      <title>Database Transaction</title>
      <link>https://www.devkuma.com/en/docs/rdbms/transaction/</link>
      <pubDate>Sun, 19 Dec 2021 01:05:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/rdbms/transaction/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-a-database-transaction&#34;&gt;What Is a Database Transaction?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A transaction is a logical unit of work performed to change the state of a database.&lt;/li&gt;
&lt;li&gt;It is a unit of work that manipulates data in a database.&lt;/li&gt;
&lt;li&gt;A transaction can perform several operations.&lt;/li&gt;
&lt;li&gt;If even one operation fails while a transaction is running, the entire transaction is rolled back. If all operations succeed, a commit is performed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;what-is-transaction-acid&#34;&gt;What Is Transaction ACID?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Atomicity
&lt;ul&gt;
&lt;li&gt;Ensures that one transaction is not partially executed or interrupted.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Consistency
&lt;ul&gt;
&lt;li&gt;Means that even when a transaction completes successfully, the database remains in the same valid state as before the work.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Isolation
&lt;ul&gt;
&lt;li&gt;Ensures that other work cannot interfere while a Transaction is being performed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Durability
&lt;ul&gt;
&lt;li&gt;Means that successfully completed transactions must be reflected permanently.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;notes-when-using-transactions&#34;&gt;Notes When Using Transactions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Minimize the scope of a transaction.
&lt;ul&gt;
&lt;li&gt;It is important to minimize the scope of a transaction.&lt;/li&gt;
&lt;li&gt;Because the number of database connections is limited, the time a connection is held should be minimized.&lt;/li&gt;
&lt;li&gt;Otherwise, other services may have to wait to use the connection.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;what-are-the-types-and-characteristics-of-transaction-isolation-levels&#34;&gt;What Are the Types and Characteristics of Transaction Isolation Levels?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;READ UNCOMMITTED
&lt;ul&gt;
&lt;li&gt;When executing a SELECT query, data that has not been committed by another transaction can be read.&lt;/li&gt;
&lt;li&gt;Reading uncommitted data is called a dirty read.&lt;/li&gt;
&lt;li&gt;Be careful because data that has only been inserted and may be rolled back, meaning data that has not been committed, can be read.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;READ COMMITTED
&lt;ul&gt;
&lt;li&gt;Read Committed guarantees a level where only committed data is visible during SELECT, and most DBMSs use Read Committed as the default.&lt;/li&gt;
&lt;li&gt;Read Committed guarantees that dirty reads, which occur in Read Uncommitted, do not occur.&lt;/li&gt;
&lt;li&gt;Even if a transaction has not performed COMMIT, the value may already be reflected in the DB. To guarantee data before COMMIT, the process of restoring uncommitted queries is needed. In other words, Consistent Read must be performed at this point.&lt;/li&gt;
&lt;li&gt;The problem with Read Committed is that it does not guarantee that data remains the same each time SELECT is performed within a single transaction. This is because if another transaction has committed that data, Read Committed returns the committed data.&lt;/li&gt;
&lt;li&gt;For this reason, Read Committed is also called Non-repeatable Read.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;REPEATABLE READ
&lt;ul&gt;
&lt;li&gt;Unlike Read Committed, Repeatable Read guarantees that values read do not change even if SELECT is performed repeatedly within a transaction.&lt;/li&gt;
&lt;li&gt;A Repeatable Read transaction records the time when the first SELECT is performed, and for all subsequent SELECTs, performs Consistent Read based on that point in time.&lt;/li&gt;
&lt;li&gt;Therefore, even if another transaction commits during the transaction, newly committed data is not visible.&lt;/li&gt;
&lt;li&gt;This is because it reads the snapshot created at the first SELECT.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;SERIALIZABLE
&lt;ul&gt;
&lt;li&gt;Serializable provides the highest isolation level, as if all work were processed in one transaction.&lt;/li&gt;
&lt;li&gt;A common issue with both Read Committed and Repeatable Read is that Phantom Read can occur.
&lt;ul&gt;
&lt;li&gt;What is Phantom Read?
&lt;ul&gt;
&lt;li&gt;Phantom Read refers to a case where an UPDATE command in one transaction is lost or overwritten, or where after UPDATE and COMMIT, a subsequent query shows unexpected values or data has been lost.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Unlike those levels, in SERIALIZABLE, all SELECT queries are automatically changed to SELECT &amp;hellip; FOR SHARE, which can prevent several situations that Repeatable Read cannot prevent.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;commit-and-rollback&#34;&gt;Commit and Rollback&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Commit
&lt;ul&gt;
&lt;li&gt;When a transaction ends, it notifies the transaction manager that it has completed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rollback
&lt;ul&gt;
&lt;li&gt;When transaction processing ends abnormally and breaks database consistency, rollback means canceling all operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>RDBMS</category>
      
      <category>Transaction</category>
      
    </item>
    
  </channel>
</rss>
