<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Azure Upsert Activity very slow with trigger in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4672071#M7664</link>
    <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453165" data-lia-user-login="shuhn1229" class="lia-mention lia-mention-user"&gt;shuhn1229&lt;/a&gt;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Just following up to see if the solution provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;If the response addressed your query, kindly mark it as &lt;SPAN&gt;Accepted Solution&lt;/SPAN&gt; and click &lt;SPAN&gt;Yes&lt;/SPAN&gt; if you found it helpful — this will benefit others in the community as well.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Best regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Prasanna Kumar&lt;/P&gt;</description>
    <pubDate>Tue, 29 Apr 2025 04:51:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-04-29T04:51:08Z</dc:date>
    <item>
      <title>Azure Upsert Activity very slow with trigger</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4590750#M7187</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I a new to ADF and Azure SQL so please be patient. I have an azure sql table and I created the following trigger to modify a last modified date column in azure sql if a copy activity using upsert modifies the row:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE TRIGGER TR_wrsh_ModifiedDate
ON [dbo].[WRSH] 

AFTER UPDATE 
AS 
BEGIN
    UPDATE [dbo].[WRSH] 
    SET ModifiedDate = GETDATE() 
    WHERE Barcode IN (SELECT Barcode FROM inserted);

    -- UPDATE YourTableName SET ModifiedDate = GETDATE() WHERE ID NOT IN (SELECT ID FROM inserted);
END;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I've noticed that this absolutely kills performance of the copy activity, even when the column in indexed. Any suggestions here? Is my SQL and understanding of setting this up OK? I just want to create a lastmodified time stamp if the upsert activity results in an update.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 20:07:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4590750#M7187</guid>
      <dc:creator>shuhn1229</dc:creator>
      <dc:date>2025-02-28T20:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Upsert Activity very slow with trigger</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4590838#M7188</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453165" data-lia-user-login="shuhn1229" class="lia-mention lia-mention-user"&gt;shuhn1229&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your `AFTER UPDATE` trigger performs a correlated update on the entire table, which becomes inefficient for large batches&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Optimized Approach would be to Use a JOIN instead of `IN` clause:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UPDATE w&lt;BR /&gt;SET ModifiedDate = GETDATE()&lt;BR /&gt;FROM [dbo].[WRSH] w&lt;BR /&gt;INNER JOIN inserted i ON w.Barcode = i.Barcode;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This leverages set-based operations more efficiently.&lt;BR /&gt;• Ensure `Barcode` is indexed (ideally clustered if it’s the primary key) to optimize the join operation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if trigger is not necessary&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For high-throughput scenarios, consider temporal tables (Azure SQL feature):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ALTER TABLE [dbo].[WRSH] ADD&lt;BR /&gt;ModifiedDate datetime2 GENERATED ALWAYS AS ROW START HIDDEN DEFAULT GETUTCDATE(),&lt;BR /&gt;PERIOD FOR SYSTEM_TIME (ModifiedDate, Garbawgy);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eliminates trigger overhead by auto-tracking changes.&lt;BR /&gt;• Provides built-in auditing without custom code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 22:02:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4590838#M7188</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-02-28T22:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Upsert Activity very slow with trigger</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4590910#M7190</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Thank you very much, didn;t realize the second was even an option&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;how sigjificant of a performance hit do you suspect I'll take with a copy activity for a table in the millions of source/sink with the temporal table&lt;/LI&gt;&lt;LI&gt;If I delete the temporal column "&lt;SPAN&gt;ModifiedDate" will this revert the table to its previous form?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you so very much&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Feb 2025 23:50:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4590910#M7190</guid>
      <dc:creator>shuhn1229</dc:creator>
      <dc:date>2025-02-28T23:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Upsert Activity very slow with trigger</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4667538#M7607</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453165" data-lia-user-login="shuhn1229" class="lia-mention lia-mention-user"&gt;shuhn1229&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to the Microsoft Fabric Forum Community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CREATE TRIGGER TR_wrsh_ModifiedDate&lt;BR /&gt;ON [dbo].[WRSH]&lt;BR /&gt;AFTER UPDATE&lt;BR /&gt;AS&lt;BR /&gt;BEGIN&lt;BR /&gt;SET NOCOUNT ON;&lt;/P&gt;
&lt;P&gt;UPDATE wrsh&lt;BR /&gt;SET ModifiedDate = GETDATE()&lt;BR /&gt;FROM dbo.WRSH AS wrsh&lt;BR /&gt;INNER JOIN inserted AS i ON wrsh.Barcode = i.Barcode;&lt;BR /&gt;END;&lt;/P&gt;
&lt;P&gt;Using a JOIN with the inserted pseudo-table improves performance by ensuring only the affected rows are updated.&lt;/P&gt;
&lt;P&gt;For best results, ensure the Barcode column is indexed — preferably as a primary key or unique non-clustered index — to speed up the join operation in the trigger.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you found this response helpful, please consider marking it as the accepted solution and giving it a thumbs-up to help others in the community.&lt;/P&gt;
&lt;P&gt;Thank you &amp;amp; regards,&lt;BR /&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 01:18:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4667538#M7607</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-25T01:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Upsert Activity very slow with trigger</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4672071#M7664</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453165" data-lia-user-login="shuhn1229" class="lia-mention lia-mention-user"&gt;shuhn1229&lt;/a&gt;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Just following up to see if the solution provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;If the response addressed your query, kindly mark it as &lt;SPAN&gt;Accepted Solution&lt;/SPAN&gt; and click &lt;SPAN&gt;Yes&lt;/SPAN&gt; if you found it helpful — this will benefit others in the community as well.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Best regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 04:51:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4672071#M7664</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-29T04:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Upsert Activity very slow with trigger</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4676661#M7695</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453165" data-lia-user-login="shuhn1229" class="lia-mention lia-mention-user"&gt;shuhn1229&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;We wanted to kindly check in to see if everything is working as expected after trying the suggested solution. If there’s anything else we can assist with, please don’t hesitate to ask.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;If the issue is resolved, we’d appreciate it if you could mark the helpful reply as &lt;SPAN&gt;Accepted Solution&lt;/SPAN&gt; — it helps others who might face a similar issue.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Warm regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 04:20:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4676661#M7695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-02T04:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Upsert Activity very slow with trigger</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4679377#M7710</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453165" data-lia-user-login="shuhn1229" class="lia-mention lia-mention-user"&gt;shuhn1229&lt;/a&gt;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Just a gentle reminder — has your issue been resolved? If so, we’d be grateful if you could mark the solution that worked as &lt;SPAN&gt;Accepted Solution&lt;/SPAN&gt;, or feel free to share your own if you found a different fix.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;This not only closes the loop on your query but also helps others in the community solve similar issues faster.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Thank you for your time and feedback!&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Best,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2025 05:32:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Upsert-Activity-very-slow-with-trigger/m-p/4679377#M7710</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-05T05:32:04Z</dc:date>
    </item>
  </channel>
</rss>

