<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pg_prewarm &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/pg_prewarm/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Mon, 09 Apr 2018 18:39:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>PostgreSQL: Load table into Buffer Cache, Increase the Speed of Accessing data</title>
		<link>https://www.dbrnd.com/2018/04/postgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm/</link>
					<comments>https://www.dbrnd.com/2018/04/postgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 08 Apr 2018 16:16:20 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Buffer Cache]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Memory Engine]]></category>
		<category><![CDATA[pg_prewarm]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[Table Performance]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7351</guid>

					<description><![CDATA[<div><img width="675" height="400" src="https://www.dbrnd.com/wp-content/uploads/2017/12/SQLRam.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQLRam" decoding="async" fetchpriority="high" /></div>In this post, I am sharing a demonstration on how to load a table data into the Buffer Cache of PostgreSQL? If your table available in the Buffer Cache, you can reduce the cost of DISK I/O. The similar feature of Memory Engine or Database In-Memory concept. But this is not always good, because compare [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="675" height="400" src="https://www.dbrnd.com/wp-content/uploads/2017/12/SQLRam.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQLRam" decoding="async" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm%2F&amp;linkname=PostgreSQL%3A%20Load%20table%20into%20Buffer%20Cache%2C%20Increase%20the%20Speed%20of%20Accessing%20data" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm%2F&amp;linkname=PostgreSQL%3A%20Load%20table%20into%20Buffer%20Cache%2C%20Increase%20the%20Speed%20of%20Accessing%20data" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm%2F&amp;linkname=PostgreSQL%3A%20Load%20table%20into%20Buffer%20Cache%2C%20Increase%20the%20Speed%20of%20Accessing%20data" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm%2F&amp;linkname=PostgreSQL%3A%20Load%20table%20into%20Buffer%20Cache%2C%20Increase%20the%20Speed%20of%20Accessing%20data" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm%2F&amp;linkname=PostgreSQL%3A%20Load%20table%20into%20Buffer%20Cache%2C%20Increase%20the%20Speed%20of%20Accessing%20data" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm%2F&amp;linkname=PostgreSQL%3A%20Load%20table%20into%20Buffer%20Cache%2C%20Increase%20the%20Speed%20of%20Accessing%20data" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm%2F&#038;title=PostgreSQL%3A%20Load%20table%20into%20Buffer%20Cache%2C%20Increase%20the%20Speed%20of%20Accessing%20data" data-a2a-url="https://www.dbrnd.com/2018/04/postgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm/" data-a2a-title="PostgreSQL: Load table into Buffer Cache, Increase the Speed of Accessing data"></a></p><p>In this post, I am sharing a demonstration on how to load a table data into the Buffer Cache of PostgreSQL? </p>
<p>If your table available in the Buffer Cache, you can reduce the cost of DISK I/O. The similar feature of Memory Engine or Database In-Memory concept. </p>
<blockquote><p>But this is not always good, because compare to DISK we have always the limited size of Memory and memory is also require of OS. But in some special cases, we can load frequently used table into Buffer Cache of PostgreSQL.</p>
<p>Before loading any table into the Buffer Cache, you must check the size of the table and the available size of Buffer Cache. </p></blockquote>
<p>Using pg_prewarm module we can do this. It provides a convenient way to load relation data into either the operating system buffer cache or the PostgreSQL buffer cache. </p>
<blockquote><p><em>Once you perform the below test, next question would be &#8220;How to check the status of Buffer Cache for each table?&#8221;<br />
Please visit tomorrow&#8217;s article for this solution&#8230;</em></p>
<blockquote class="wp-embedded-content" data-secret="xJerMADuzu"><p><a href="https://www.dbrnd.com/2018/04/postgresql-script-to-check-the-status-of-shared-buffer-use-pg_buffercache/">PostgreSQL: Script to check the status of Shared Buffer (Use pg_buffercache)</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2018/04/postgresql-script-to-check-the-status-of-shared-buffer-use-pg_buffercache/embed/#?secret=xJerMADuzu" data-secret="xJerMADuzu" width="600" height="338" title="&#8220;PostgreSQL: Script to check the status of Shared Buffer (Use pg_buffercache)&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</p></blockquote>
<p><strong>Please check the below demonstration:</strong></p>
<p><strong>Create two sample tables:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_ItemTransactions_1
 (
     TranID SERIAL
     ,TransactionDate TIMESTAMPTZ
     ,TransactionName TEXT
 );
 
INSERT INTO tbl_ItemTransactions_1
(TransactionDate, TransactionName)
SELECT x, 'dbrnd' 
FROM generate_series('2010-01-01 00:00:00'::timestamptz, '2018-02-01 00:00:00'::timestamptz,'1 minutes'::interval) a(x);

CREATE TABLE tbl_ItemTransactions_2
 (
     TranID SERIAL
     ,TransactionDate TIMESTAMPTZ
     ,TransactionName TEXT
 );
 
INSERT INTO tbl_ItemTransactions_2
(TransactionDate, TransactionName)
SELECT x, 'dbrnd' 
FROM generate_series('2010-01-01 00:00:00'::timestamptz, '2018-02-01 00:00:00'::timestamptz,'1 minutes'::interval) a(x);</pre> </p>
<p><strong>Create pg_prewarm extension:</strong></p>
<pre class="crayon-plain-tag">CREATE EXTENSION pg_prewarm;</pre> </p>
<p><strong>Now, prefatch the tbl_ItemTransactions_1 table using pg_prewarm:</strong></p>
<pre class="crayon-plain-tag">SELECT pg_prewarm('tbl_ItemTransactions_1');</pre> </p>
<p><strong>Check the execution plan of tbl_ItemTransactions_1:</strong><br />
The execution plan of prefatched table is quite faster than normal table. </p>
<pre class="crayon-plain-tag">EXPLAIN ANALYZE SELECT *FROM tbl_ItemTransactions_1;

Planning time: 0.130 ms
Execution time: 356.237 ms</pre> </p>
<p><strong>Check the execution plan of tbl_ItemTransactions_2:</strong></p>
<pre class="crayon-plain-tag">EXPLAIN ANALYZE SELECT *FROM tbl_ItemTransactions_2;

Planning time: 0.210 ms
Execution time: 752.010 ms</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/04/postgresql-load-table-into-buffer-cache-increase-the-speed-of-accessing-data-pg_prewarm/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
