<?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>Universally Unique Identifier &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/universally-unique-identifier/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 Oct 2017 14:28:38 +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>PostgreSQL: Optimized way to populate new Column (UUID) in a Large Table</title>
		<link>https://www.dbrnd.com/2016/08/postgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 21 Aug 2016 14:27:16 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[large column]]></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 Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[Universally Unique Identifier]]></category>
		<category><![CDATA[UUID]]></category>
		<category><![CDATA[UUID Data type]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3547</guid>

					<description><![CDATA[The default nature of PostgreSQL is based on MVCC architecture which managed by different type of ROW versions. You can read more about MVCC, What is Multi Version Concurrency Control (MVCC) Why I have started this article with MVCC because whenever we update data into the table, it creates a new record and marked the [&#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%2F2016%2F08%2Fpostgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier%2F&amp;linkname=PostgreSQL%3A%20Optimized%20way%20to%20populate%20new%20Column%20%28UUID%29%20in%20a%20Large%20Table" 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%2F2016%2F08%2Fpostgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier%2F&amp;linkname=PostgreSQL%3A%20Optimized%20way%20to%20populate%20new%20Column%20%28UUID%29%20in%20a%20Large%20Table" 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%2F2016%2F08%2Fpostgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier%2F&amp;linkname=PostgreSQL%3A%20Optimized%20way%20to%20populate%20new%20Column%20%28UUID%29%20in%20a%20Large%20Table" 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%2F2016%2F08%2Fpostgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier%2F&amp;linkname=PostgreSQL%3A%20Optimized%20way%20to%20populate%20new%20Column%20%28UUID%29%20in%20a%20Large%20Table" 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%2F2016%2F08%2Fpostgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier%2F&amp;linkname=PostgreSQL%3A%20Optimized%20way%20to%20populate%20new%20Column%20%28UUID%29%20in%20a%20Large%20Table" 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%2F2016%2F08%2Fpostgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier%2F&amp;linkname=PostgreSQL%3A%20Optimized%20way%20to%20populate%20new%20Column%20%28UUID%29%20in%20a%20Large%20Table" 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%2F2016%2F08%2Fpostgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier%2F&#038;title=PostgreSQL%3A%20Optimized%20way%20to%20populate%20new%20Column%20%28UUID%29%20in%20a%20Large%20Table" data-a2a-url="https://www.dbrnd.com/2016/08/postgresql-optimized-way-to-populate-new-large-column-in-a-table-uuid-universally-unique-identifier/" data-a2a-title="PostgreSQL: Optimized way to populate new Column (UUID) in a Large Table"></a></p><p>The default nature of PostgreSQL is based on MVCC architecture which managed by different type of ROW versions.<br />
You can read more about MVCC,</p>
<blockquote class="wp-embedded-content" data-secret="bpjesSACk4"><p><a href="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/">What is Multi Version Concurrency Control (MVCC)</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/embed/#?secret=bpjesSACk4" data-secret="bpjesSACk4" width="600" height="338" title="&#8220;What is Multi Version Concurrency Control (MVCC)&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>Why I have started this article with MVCC because whenever we update data into the table, it creates a new record and marked the old record as an old version or dead tuple.</p></blockquote>
<p>You can visit UUID related article here,</p>
<blockquote class="wp-embedded-content" data-secret="HcGrULmlEJ"><p><a href="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/">Database Theory: The truth about Universally Unique Identifier &#8211; UUID</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/embed/#?secret=HcGrULmlEJ" data-secret="HcGrULmlEJ" width="600" height="338" title="&#8220;Database Theory: The truth about Universally Unique Identifier &#8211; UUID&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="cFzokz062d"><p><a href="https://www.dbrnd.com/2016/03/postgresql-working-with-universally-unique-identifier-uuid-data-type/">PostgreSQL: Working with Universally Unique Identifier &#8211; UUID Data type</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/postgresql-working-with-universally-unique-identifier-uuid-data-type/embed/#?secret=cFzokz062d" data-secret="cFzokz062d" width="600" height="338" title="&#8220;PostgreSQL: Working with Universally Unique Identifier &#8211; UUID Data type&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>My problem:</strong></p>
<blockquote><p>One of our table size is more than 30gb and I got one requirement to add one new column with default UUID data. This table is already loaded by bulk insertion and exclusive lock never work in this situation. </p></blockquote>
<blockquote><p>While adding a column with default value requires PostgreSQL to make new versions of all rows, rewritten the entire table &#8211; indexes and store them on the disk and during that time Table will be locked.</p></blockquote>
<p><strong>The Solution should be like:</strong></p>
<blockquote><p>This task is required to perform on Production report server so it is very much important to take care about everything like: no exclusive lock, within given time frame limit, data should not be fragmented.<br />
I have tried different approaches which are, I am going to share in this article.</p></blockquote>
<p><strong>Option 1: </strong></p>
<blockquote><p>Add new column with NULL value, do not assign any default value in ALTER statement. </p></blockquote>
<blockquote><p>After adding a new column, we should run different small batches to update the newly created column.</p></blockquote>
<blockquote><p>Find out data fragmentation, dead tuples and try to optimize and remove using VACUUM &#8211; ANALYZE.</p></blockquote>
<p><strong>Option 2:</strong></p>
<blockquote><p>CREATE one new blank table with require all old and new columns.<br />
Create different small batches and move data from Old table to the newly created table. </p></blockquote>
<blockquote><p>While transferring the data, populate default value of the new column. (In my case, I have generated UUID on the fly)<br />
ADD all require constraint and indexes on the newly created table.<br />
Stop all the running data insertion queues for a while, drop the old table and rename a  new table to require an original table name. </p></blockquote>
<p>Yet, I am not 100% sure about these approaches, but I have done my task without any locking issue and completed within given time frame. </p>
<p><strong>If you have any other optimized way, Please share your ideas.</strong></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Developer (T-SQL) Interview Questions and Answers (Day-15)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 26 Jun 2016 19:58:39 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[contains]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Database Developer]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[freetext]]></category>
		<category><![CDATA[Full text searching]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[Universally Unique Identifier]]></category>
		<category><![CDATA[UUID Data type]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3082</guid>

					<description><![CDATA[What do you know about the Universally Unique Identifier &#8211; UUID data type? Database Theory: The truth about Universally Unique Identifier &#8211; UUID When we are declaring a variable using SET or SELECT, What is the performance different between SET and SELECT? SQL Server: Truth about assigning variables using SET versus SELECT What is the [&#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%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" 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%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" 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%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" 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%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" 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%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" 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%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" 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%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&#038;title=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15/" data-a2a-title="SQL Server: Database Developer (T-SQL) Interview Questions and Answers (Day-15)"></a></p><p><strong>What do you know about the Universally Unique Identifier &#8211; UUID data type?</strong></p>
<blockquote class="wp-embedded-content" data-secret="SEzTGAfIgs"><p><a href="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/">Database Theory: The truth about Universally Unique Identifier &#8211; UUID</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/embed/#?secret=SEzTGAfIgs" data-secret="SEzTGAfIgs" width="600" height="338" title="&#8220;Database Theory: The truth about Universally Unique Identifier &#8211; UUID&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>When we are declaring a variable using SET or SELECT, What is the performance different between SET and SELECT?</strong></p>
<blockquote class="wp-embedded-content" data-secret="LWlmYmIfBE"><p><a href="https://www.dbrnd.com/2016/03/sql-server-truth-about-assigning-variables-using-set-versus-select/">SQL Server: Truth about assigning variables using SET versus SELECT</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/sql-server-truth-about-assigning-variables-using-set-versus-select/embed/#?secret=LWlmYmIfBE" data-secret="LWlmYmIfBE" width="600" height="338" title="&#8220;SQL Server: Truth about assigning variables using SET versus SELECT&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is the purpose of OPENXML clause SQL server stored procedure?</strong></p>
<blockquote><p>OPENXML parses the XML data in SQL Server in an efficient manner. It’s primary ability is to insert XML data to the RDB. It is also possible to query the data by using OpenXML. The path of the XML element needs to be specified by using ‘xpath’.</p></blockquote>
<p><strong>What is the use of @@CPU_BUSY statement?</strong></p>
<blockquote><p>It returns the time that SQL Server has spent working since it was last started.</p></blockquote>
<p><strong>Explain the use of keyword WITH ENCRYPTION. Create a Store Procedure with Encryption.</strong></p>
<blockquote><p>WITH ENCRYPTION indicates that SQL Server will convert the original text of CREATE PROCEDURE statement to an encrypted format. Users that do not have no access to system tables or database files cannot retrieve the encrypted text. However, the text will be available to privileged users.</p></blockquote>
<p><strong>If you need to script a table with data, how will you do that?</strong></p>
<blockquote><p>One way to achieve this by using  Generate Script Task in SSMS.</p>
<p>Right click on database and then go to Tasks and then go to Generate Scripts.</p></blockquote>
<p><strong>I have two tables with the same columns and data types. If I need toget distinct records from both of tables how can I do that?</strong></p>
<blockquote><p>We can use the UNION operators.</p></blockquote>
<p><strong>Can we send emails in HTML Format from SQL Server, How will you do that?</strong></p>
<blockquote><p>We can send email from SQL Server in HTML format by using dbo.sp_send_dbmail stored procedure. To send email in HTML format, we have to build the body of email with HTML Tags. The below code can be used to send basis HTML formatted email. If you want to loop through some results of table and send in HTML formatted email.</p></blockquote>
<p><strong>Can we create triggers on temp table?</strong></p>
<blockquote><p>No: we cannot create a trigger on temp table.</p></blockquote>
<p><strong>How would you get the size of a SQL Server Table?</strong></p>
<blockquote><p>EXEC sp_spaceused &#8216;TableName&#8217;</p></blockquote>
<p><strong>How would you determine if the expression is Numeric?</strong></p>
<blockquote><p><strong>ISNUMERIC( ):</strong> function is provided to us in SQL Server to check if the expression is valid numeric type or not. As per Microsoft it should work with Integers and Decimal data types and if data is valid integer or decimal, ISNumeric() should return us 1 else 0.</p>
<p><strong>Try_Convert( ):</strong> In SQL Server 2012. Microsoft introduced new function call Try_Convert( ). You can use try_convert function to convert to required data type and if it is not able to convert then it will return Null as output.</p></blockquote>
<p><strong>Which function is used to convert the integer value into spaces?</strong></p>
<blockquote><p>The SPACE function converts the specified integer value into spaces.</p><pre class="crayon-plain-tag">SELECT SPACE(8);</pre><p>
</p></blockquote>
<p><strong>What is constant folding?</strong></p>
<p><strong>SQL Server evaluates some constant expression early to improve the query performance. This is called constant folding.</strong></p>
<p><strong>What is a full text search in SQL Server?</strong></p>
<blockquote><p>Full text indexing is a great feature that solves a database problem, the searching of textual data columns for specific words and phrases in SQL Server databases.</p>
<p>Full Text Index can be used to search words, phrases and multiple forms of a word or phrase using FREETEXT () and CANTAINS () with “and” or “or” operators.</p></blockquote>
<p><strong>Can you execute full-text queries on a table without full-text index on that column?</strong></p>
<blockquote><p><strong>No: </strong>Before you can run full-text queries on a table, the database administrator must create a full-text index on the table. The full-text index includes one or more character-based columns in the table. These columns can have any of the following data types: char, varchar, nchar, nvarchar, text, ntext, image, xml, or varbinary(max) and FILESTREAM.</p></blockquote>
<p><strong>Are Full-text queries are case-sensitive?</strong></p>
<blockquote><p>Full-text queries are not case-sensitive. For example, searching for &#8220;DBRND&#8221; or &#8220;dbrnd&#8221; returns the same results.</p></blockquote>
<p><strong>What is the difference between LIKE and FULL-Text Search?</strong></p>
<blockquote><p>In contrast to full-text search, the LIKETransact-SQL predicate works on character patterns only. Also, you cannot use the LIKE predicate to query formatted binary data. Furthermore, a LIKE query against a large amount of unstructured text data is much slower than an equivalent full-text query against the same data.</p>
<p>A LIKE query against millions of rows of text data can take minutes to return; whereas a full-text query can take only seconds or less against the same data, depending on the number of rows that are returned.</p></blockquote>
<p><strong>What is a Full-Text Engine?</strong></p>
<blockquote><p>The Full-Text Engine in SQL Server is fully integrated with the query processor. The Full-Text Engine compiles and executes full-text queries. As part of query execution, the Full-Text Engine might receive input from the thesaurus and stoplist.</p></blockquote>
<p><strong>What is the internal process of Full-Text Querying?</strong></p>
<ul>
<li>The query processor passes the full-text portions of a query to the Full-Text Engine for processing. The Full-Text Engine performs word breaking and, optionally, thesaurus expansions, stemming, and stopword (noise-word) processing.</li>
<li>Then the full-text portions of the query are represented in the form of SQL operators, primarily as streaming table-valued functions (STVFs).</li>
<li>During query execution, these STVFs access the inverted index to retrieve the correct results. The results are either returned to the client at this point, or they are further processed before being returned to the client.</li>
</ul>
<p><strong>What is CONTAINS and FREETEXT of Full-Text predicates?</strong></p>
<blockquote><p>The CONTAINS and FREETEXT predicates return a TRUE or FALSE value. They can be used only to specify selection criteria for determining whether a given row matches the full-text query. Matching rows are returned in the result set. CONTAINS and FREETEXT are specified in the WHERE or HAVING clause of a SELECT statement. They can be combined with any of the other Transact-SQL predicates, such as LIKE and BETWEEN.</p>
<p>When using CONTAINS or FREETEXT, you can specify either a single column, a list of columns, or all columns in the table to be searched.</p></blockquote>
<p><strong>What it is not recommended to name the user defined Stored Procedures with sp_?</strong></p>
<blockquote><p>They are system defined and mostly resides under the master database so if we write a user defined stored procedure by the name sp_ the query engine will first search the Stored Procedure in the master database and if not found then it will search in the current session database.</p>
<p>This brings unnecessary round trip and reduce the overall performance of user defined stored procedures.</p></blockquote>
<p><strong>Can we use the PRINT statement in SQL Server Function?</strong></p>
<blockquote><p>No: We cannot use it.</p></blockquote>
<p><strong>If you are working on a SQL database and if suddenly a developer changes the code and your queries results start giving errors, how will you check using a T-SQL query (on system tables) that what has changed in the database.</strong><br />
<pre class="crayon-plain-tag">select o.name, o.object_id, o.modify_date, c.text
from sys.objects o
join sys.syscomments c
on o.object_id = c.id</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Working with Universally Unique Identifier &#8211; UUID Data type</title>
		<link>https://www.dbrnd.com/2016/03/postgresql-working-with-universally-unique-identifier-uuid-data-type/</link>
					<comments>https://www.dbrnd.com/2016/03/postgresql-working-with-universally-unique-identifier-uuid-data-type/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 03 Mar 2016 18:26:32 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gen_random_uuid()]]></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 Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[Universally Unique Identifier]]></category>
		<category><![CDATA[UUID]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1893</guid>

					<description><![CDATA[The PostgreSQL provides Universally Unique Identifier -UUID data type and related functions. In the previous post, I shared the truth about Universally Unique Identifier - UUID. You can visit this article here. PostgreSQL provides two extensions. 1. uuid-ossp 2. pgcrypto. You can install above extension using below script. [crayon-6aaa6bc0b0999811032383/] I am using pgcrypto extension for [&#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%2F2016%2F03%2Fpostgresql-working-with-universally-unique-identifier-uuid-data-type%2F&amp;linkname=PostgreSQL%3A%20Working%20with%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID%20Data%20type" 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%2F2016%2F03%2Fpostgresql-working-with-universally-unique-identifier-uuid-data-type%2F&amp;linkname=PostgreSQL%3A%20Working%20with%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID%20Data%20type" 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%2F2016%2F03%2Fpostgresql-working-with-universally-unique-identifier-uuid-data-type%2F&amp;linkname=PostgreSQL%3A%20Working%20with%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID%20Data%20type" 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%2F2016%2F03%2Fpostgresql-working-with-universally-unique-identifier-uuid-data-type%2F&amp;linkname=PostgreSQL%3A%20Working%20with%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID%20Data%20type" 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%2F2016%2F03%2Fpostgresql-working-with-universally-unique-identifier-uuid-data-type%2F&amp;linkname=PostgreSQL%3A%20Working%20with%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID%20Data%20type" 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%2F2016%2F03%2Fpostgresql-working-with-universally-unique-identifier-uuid-data-type%2F&amp;linkname=PostgreSQL%3A%20Working%20with%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID%20Data%20type" 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%2F2016%2F03%2Fpostgresql-working-with-universally-unique-identifier-uuid-data-type%2F&#038;title=PostgreSQL%3A%20Working%20with%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID%20Data%20type" data-a2a-url="https://www.dbrnd.com/2016/03/postgresql-working-with-universally-unique-identifier-uuid-data-type/" data-a2a-title="PostgreSQL: Working with Universally Unique Identifier – UUID Data type"></a></p><p>The PostgreSQL provides Universally Unique Identifier -UUID data type and related functions.</p>
<p><strong><code>In the previous post, I shared the truth about Universally Unique Identifier - UUID.<br />
<a href="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/" target="_blank">You can visit this article here</a>.</code></strong></p>
<p>PostgreSQL provides two extensions.</p>
<blockquote><p>1. uuid-ossp<br />
2. pgcrypto.</p></blockquote>
<p>You can install above extension using below script.</p><pre class="crayon-plain-tag">CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS pgcrypto;</pre><p>
I am using pgcrypto extension for generating an UUID.</p>
<p><strong>Below is a small demonstration:</strong></p>
<p><strong>Generate UUID using gen_random_uuid():</strong></p><pre class="crayon-plain-tag">SELECT gen_random_uuid();</pre><p>
<p><strong>Create a sample table with UUID Data type:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_UUIDSample
(  
   MyUUID UUID PRIMARY KEY DEFAULT gen_random_uuid()
   ,Name TEXT   
);</pre><p>
<p><strong>Insert sample data:</strong></p><pre class="crayon-plain-tag">INSERT INTO tbl_UUIDSample (Name)
VALUES
('Anvesh'),('Martin')
,('Roy'),('Jenny')
,('Ronic'),('Monika');</pre><p>
<p><strong>The Result:</strong></p><pre class="crayon-plain-tag">SELECT *FROM tbl_UUIDSample;</pre><p>
<a href="https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLUUID.png" rel="attachment wp-att-1897"><img loading="lazy" decoding="async" class="alignnone wp-image-1897 size-full" title="PostgreSQL UUID" src="https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLUUID.png" alt="PostgreSQL UUID" width="311" height="147" srcset="https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLUUID.png 311w, https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLUUID-300x142.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/03/PostgreSQLUUID-150x71.png 150w" sizes="auto, (max-width: 311px) 100vw, 311px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/postgresql-working-with-universally-unique-identifier-uuid-data-type/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Database Theory: The truth about Universally Unique Identifier &#8211; UUID</title>
		<link>https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/</link>
					<comments>https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 02 Mar 2016 20:13:17 +0000</pubDate>
				<category><![CDATA[Database Theory]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database concept]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database standards]]></category>
		<category><![CDATA[database topic]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[RDBMS]]></category>
		<category><![CDATA[Universally Unique Identifier]]></category>
		<category><![CDATA[UUID]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1884</guid>

					<description><![CDATA[I am Sharing an important theory for all Database Architects and Designers. We are following a common practice for creating a sequential, unique number for a database system. The best practice is to create a primary integer key for every table which represents the tuples. But you should also know about UUID. You can visit [&#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%2F2016%2F03%2Fdatabase-theory-the-truth-about-universally-unique-identifier-uuid%2F&amp;linkname=Database%20Theory%3A%20The%20truth%20about%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID" 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%2F2016%2F03%2Fdatabase-theory-the-truth-about-universally-unique-identifier-uuid%2F&amp;linkname=Database%20Theory%3A%20The%20truth%20about%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID" 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%2F2016%2F03%2Fdatabase-theory-the-truth-about-universally-unique-identifier-uuid%2F&amp;linkname=Database%20Theory%3A%20The%20truth%20about%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID" 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%2F2016%2F03%2Fdatabase-theory-the-truth-about-universally-unique-identifier-uuid%2F&amp;linkname=Database%20Theory%3A%20The%20truth%20about%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID" 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%2F2016%2F03%2Fdatabase-theory-the-truth-about-universally-unique-identifier-uuid%2F&amp;linkname=Database%20Theory%3A%20The%20truth%20about%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID" 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%2F2016%2F03%2Fdatabase-theory-the-truth-about-universally-unique-identifier-uuid%2F&amp;linkname=Database%20Theory%3A%20The%20truth%20about%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID" 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%2F2016%2F03%2Fdatabase-theory-the-truth-about-universally-unique-identifier-uuid%2F&#038;title=Database%20Theory%3A%20The%20truth%20about%20Universally%20Unique%20Identifier%20%E2%80%93%20UUID" data-a2a-url="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/" data-a2a-title="Database Theory: The truth about Universally Unique Identifier – UUID"></a></p><p>I am Sharing an important theory for all Database Architects and Designers. </p>
<p>We are following a common practice for creating a sequential, unique number for a database system.  </p>
<blockquote><p>
<em>The best practice is to create a primary integer key for every table which represents the tuples.<br />
But you should also know about UUID.<br />
</em><a href="https://www.dbrnd.com/2015/09/best-practice-for-primary-key-in-database-management-system/" target="_blank"><strong>You can visit this article on The truth about Primary Key. </strong></a></p></blockquote>
<p><strong>What is UUID and How it generates Unique Number?</strong></p>
<blockquote><p>UUID &#8211; Universally Unique Identifier has also stand as a unique string.</p>
<p>A UUID is a 128-bit number, and it used to identify different type of entities uniquely.<br />
The computation of the UUID is quick and easy to generate an ID which can be reasonably assumed to be universally unique. </p></blockquote>
<blockquote><p>The UUID is globally unique because it contains a unique combination of the network address, the timestamp of the transaction and other component details.<br />
The network address and timestamp of the transaction are enough to ensure uniqueness. </p></blockquote>
<p>Example, The standard form of UUID. It is total of 32 digits and representing the 128 bits.</p><pre class="crayon-plain-tag">c0acbc88-9q0b-4hq3-cc6u-8pp9er188a33</pre><p> </p>
<p><strong>Why we require UUID?</strong></p>
<blockquote><p>When we are working in the distributed environment system, we need UUID which identifies the integrated data from the different systems.</p></blockquote>
<blockquote><p>For example,<br />
We have two systems, System A and System B. Now I want to import some data from System A to System B without changing an ID of the source system. System B has already set of stored IDs which might conflict with System A IDs.</p>
<p>The UUID solves the above problem.</p></blockquote>
<blockquote><p>If the system is not online, the offline user also can generate a UUID at the client side for few operations. </p></blockquote>
<blockquote><p>A UUID always unique for all the systems which reside in a distributed environment. </p></blockquote>
<blockquote><p>For Example,<br />
System A inserts a record with ID 10 and at the same time System B also inserts a record with ID 10.<br />
Now, this is a collision.<br />
The UUID solves this problem.
</p></blockquote>
<blockquote><p>If the system is accessed by multiple threads, each thread has to wait for new IDs.<br />
A UUID also solve this problem because it does not depend on the previously generated key. </p></blockquote>
<blockquote><p>We can generate trillions of UUID in a year and it has very less chance of duplication. </p></blockquote>
<blockquote><p>If we recreate a Database or Table, again sequential ID starts from 1. In this kind of situations, we can use UUID. </p></blockquote>
<p><strong>Other limitations:</strong></p>
<blockquote><p>The index fragmentation is one of the major drawbacks of using UUID random keys. </p></blockquote>
<blockquote><p>We should not use UUID as a Primary key of a table. Still, I would suggest you create an integer sequential primary key and create a separate column for UUID. </p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
