<?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>Log &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/log/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>Tue, 09 Oct 2018 19:45:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: How to Aggregate data and perform Multiplication?</title>
		<link>https://www.dbrnd.com/2018/10/sql-server-how-to-aggregate-data-and-perform-multiplication/</link>
					<comments>https://www.dbrnd.com/2018/10/sql-server-how-to-aggregate-data-and-perform-multiplication/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 15 Oct 2018 16:16:00 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Aggregate Function]]></category>
		<category><![CDATA[Aggregate Multiplication]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[EXP]]></category>
		<category><![CDATA[Log]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7438</guid>

					<description><![CDATA[In this post, I am sharing an aggregate query for calculating Multiplication for each group in SQL Server. We are using an aggregate function like MAX(), SUM(). But there is no any aggregate function for Multiplication. We can use EXP/LOG expression for this exercise. EXP returns the exponential value and LOG returns the natural logarithm [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F10%2Fsql-server-how-to-aggregate-data-and-perform-multiplication%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Aggregate%20data%20and%20perform%20Multiplication%3F" 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%2F10%2Fsql-server-how-to-aggregate-data-and-perform-multiplication%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Aggregate%20data%20and%20perform%20Multiplication%3F" 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%2F10%2Fsql-server-how-to-aggregate-data-and-perform-multiplication%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Aggregate%20data%20and%20perform%20Multiplication%3F" 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%2F10%2Fsql-server-how-to-aggregate-data-and-perform-multiplication%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Aggregate%20data%20and%20perform%20Multiplication%3F" 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%2F10%2Fsql-server-how-to-aggregate-data-and-perform-multiplication%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Aggregate%20data%20and%20perform%20Multiplication%3F" 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%2F10%2Fsql-server-how-to-aggregate-data-and-perform-multiplication%2F&amp;linkname=SQL%20Server%3A%20How%20to%20Aggregate%20data%20and%20perform%20Multiplication%3F" 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%2F10%2Fsql-server-how-to-aggregate-data-and-perform-multiplication%2F&#038;title=SQL%20Server%3A%20How%20to%20Aggregate%20data%20and%20perform%20Multiplication%3F" data-a2a-url="https://www.dbrnd.com/2018/10/sql-server-how-to-aggregate-data-and-perform-multiplication/" data-a2a-title="SQL Server: How to Aggregate data and perform Multiplication?"></a></p><p>In this post, I am sharing an aggregate query for calculating Multiplication for each group in SQL Server. We are using an aggregate function like MAX(), SUM(). But there is no any aggregate function for Multiplication. </p>
<p>We can use EXP/LOG expression for this exercise. EXP returns the exponential value and LOG returns the natural logarithm of the specified float expression.</p>
<p><strong>Please check the below demonstration: </strong></p>
<p><strong>Create a table with sample data:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_GroupNumber (GroupName VARCHAR(10), GroupValue INT)

INSERT INTO tbl_GroupNumber VALUES
('A',10),('B',15),('C',20),('D',30)
,('B',30),('C',60),('D',40),('D',50)
,('A',70),('B',40),('C',10),('B',90)
GO</pre> </p>
<p><strong>Solution:</strong></p>
<pre class="crayon-plain-tag">SELECT 
	GroupName 
	,EXP(SUM(LOG(GroupValue))) AS GroupValue
FROM tbl_GroupNumber
GROUP BY GroupName</pre> </p>
<p><strong>Result:</strong></p>
<pre class="crayon-plain-tag">GroupName  GroupValue
---------- ----------------------
A          700
B          1620000
C          12000
D          60000</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/10/sql-server-how-to-aggregate-data-and-perform-multiplication/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Committed Inner transactions never releases the log disk space</title>
		<link>https://www.dbrnd.com/2017/05/sql-server-committed-inner-transactions-never-releases-the-log-disk-space/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 27 May 2017 16:16:29 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[COMMIT]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Inner transaction]]></category>
		<category><![CDATA[Log]]></category>
		<category><![CDATA[Outer transaction]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[transaction]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5336</guid>

					<description><![CDATA[In this post, I am sharing a demonstration in which you can get to know that committed inner transactions are not releasing any log disk space in SQL Server. One of our developers was telling me like when we commit the transaction it will release the occupied log space, but it is not entirely correct. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F05%2Fsql-server-committed-inner-transactions-never-releases-the-log-disk-space%2F&amp;linkname=SQL%20Server%3A%20Committed%20Inner%20transactions%20never%20releases%20the%20log%20disk%20space" 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%2F2017%2F05%2Fsql-server-committed-inner-transactions-never-releases-the-log-disk-space%2F&amp;linkname=SQL%20Server%3A%20Committed%20Inner%20transactions%20never%20releases%20the%20log%20disk%20space" 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%2F2017%2F05%2Fsql-server-committed-inner-transactions-never-releases-the-log-disk-space%2F&amp;linkname=SQL%20Server%3A%20Committed%20Inner%20transactions%20never%20releases%20the%20log%20disk%20space" 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%2F2017%2F05%2Fsql-server-committed-inner-transactions-never-releases-the-log-disk-space%2F&amp;linkname=SQL%20Server%3A%20Committed%20Inner%20transactions%20never%20releases%20the%20log%20disk%20space" 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%2F2017%2F05%2Fsql-server-committed-inner-transactions-never-releases-the-log-disk-space%2F&amp;linkname=SQL%20Server%3A%20Committed%20Inner%20transactions%20never%20releases%20the%20log%20disk%20space" 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%2F2017%2F05%2Fsql-server-committed-inner-transactions-never-releases-the-log-disk-space%2F&amp;linkname=SQL%20Server%3A%20Committed%20Inner%20transactions%20never%20releases%20the%20log%20disk%20space" 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%2F2017%2F05%2Fsql-server-committed-inner-transactions-never-releases-the-log-disk-space%2F&#038;title=SQL%20Server%3A%20Committed%20Inner%20transactions%20never%20releases%20the%20log%20disk%20space" data-a2a-url="https://www.dbrnd.com/2017/05/sql-server-committed-inner-transactions-never-releases-the-log-disk-space/" data-a2a-title="SQL Server: Committed Inner transactions never releases the log disk space"></a></p><p>In this post, I am sharing a demonstration in which you can get to know that committed inner transactions are not releasing any log disk space in SQL Server. </p>
<blockquote><p>One of our developers was telling me like when we commit the transaction it will release the occupied log space, but it is not entirely correct.<br />
If you are dealing with nested transactions, it is true only for outer committed transactions.</p></blockquote>
<p>Please check the below demonstration of this.</p>
<p><strong>Create a sample database:</strong></p>
<pre class="crayon-plain-tag">CREATE DATABASE Test_Tran;
GO
USE Test_Tran
GO</pre> </p>
<p><strong>Check the log size:</strong></p>
<pre class="crayon-plain-tag">CHECKPOINT
GO
DBCC SQLPERF ('LOGSPACE')
GO
-- the result
-- 4.557673</pre> </p>
<p><strong>Create a sample table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_TestTrans(ID INT)
GO</pre> </p>
<p><strong>Open outer and inner transaction and insert few sample records:</strong></p>
<pre class="crayon-plain-tag">BEGIN TRANSACTION OuterTrans
GO
	BEGIN TRANSACTION InnerTrans
	GO
		INSERT INTO tbl_TestTrans VALUES(88)
		GO 1000
	COMMIT TRANSACTION InnerTrans
	GO</pre> </p>
<p><strong>Check the log size:</strong><br />
The inner transaction is committed, but log size is increased, and it didn&#8217;t release the logs.</p>
<pre class="crayon-plain-tag">CHECKPOINT;
GO
DBCC SQLPERF ('LOGSPACE');
GO

-- the result:
-- 8.767107</pre> </p>
<p><strong>Now, commit outer transaction:</strong></p>
<pre class="crayon-plain-tag">COMMIT TRANSACTION OuterTrans
GO</pre> </p>
<p><strong>Check the log size:</strong><br />
Once you commit your outer transaction, it releases the log size.</p>
<pre class="crayon-plain-tag">CHECKPOINT;
GO
DBCC SQLPERF ('LOGSPACE');
GO

-- the result:
-- 5.08</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
