<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/discussions/f/data/34005/want-to-add-to-the-database-in-smaller-chunks-need-to-design-process</link><description>If I have 1000 records that I want to add to the database in smaller chunks, how should I design a process to accomplish this? 
 I have a few potential solutions, but I&amp;#39;m unsure about their performance implications: 
 
 Implementing a loop: In each iteration</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129288?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 11:56:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fa8df27b-ab48-43e1-b18a-e4e9c3008ef8</guid><dc:creator>Ankush Sharma</dc:creator><description>&lt;p&gt;&amp;nbsp;&amp;nbsp;,&lt;br /&gt;&lt;br /&gt;So now right now what i did i have created an expression rule where i am faching data from excel and as per the condition right now whenever i am changing the indexing then it will increase the batchsize by 1000 because i have 6000 records in excel sheet&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!startIndex: 1,
  local!batchSize: 1000,
  readexcelsheetpaging(
    excelDocument: cons!APO_DOCUMENT,
    sheetNumber: 0,
    pagingInfo: {
      a!forEach(
        items: enumerate(local!startIndex) + 1,
        expression: if(
          fv!index = 1,
          a!pagingInfo(startIndex: 1, batchSize: local!batchSize),
          a!pagingInfo(
            startIndex: local!batchSize * fv!item,
            batchSize: local!batchSize
          )
        )
      )
    }
  )
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now i am going to create storedprocedure for to excute this. Hopepully i am going into the right path&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129271?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 10:12:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:74e2a30b-5d71-4e39-88e2-ac743746488e</guid><dc:creator>Ankush Sharma</dc:creator><description>&lt;p&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Okay let me try&amp;nbsp;first if i need help then i will definetly reach out to the discussion. Thanks &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129263?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 10:00:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8669d874-9a64-4f8c-9bed-a0fa1cc91d55</guid><dc:creator>Konduru Chaitanya</dc:creator><description>&lt;p&gt;Create a custom paging as below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  ri!index = 1,
  a!pagingInfo(
    startIndex: 0,
    batchSize: 100
  ),
  a!forEach(
    items: enumerate(ri!index) + 1,
    expression: if(
      fv!index = 1,
      a!pagingInfo(
        startIndex: 0,
        batchSize: 100
      ),
      a!pagingInfo(
        startIndex: 100 * (fv!item - 1),
        batchSize: 100
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Next create a stored Procedure using LIMIT, Pass the above batch size to this procedure&amp;nbsp; , so this procedure would bring only certain number of rows from the staging table using the batch size, then run the actual stored procedure to push data from staging table to main transaction table.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129257?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 09:22:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bf03c815-31ab-4af8-ba9c-dda5595d373e</guid><dc:creator>Ankush Sharma</dc:creator><description>&lt;p&gt;I didn&amp;#39;t understand. For example, suppose I have 6000 records in my Excel spreadsheet. On the other side, I have an employee table with three columns: ID, name, and email, which also exists in the Excel spreadsheet.&lt;/p&gt;
&lt;p&gt;Now, I want to perform an action where a process will store data in chunks from Excel to the database. The smart service will send 1000 data entries at a time. How will the stored procedure work in this scenario?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/16/pastedimage1707470529910v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/16/pastedimage1707470554321v2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129254?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 09:18:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8a478f39-d573-40aa-877e-1818c60f2522</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;That&amp;#39;s what I do. The reason is, that I can make the temp table of text fields only, and then do the data type transformation in the stored procedure.&lt;/p&gt;
&lt;p&gt;If you need to run multiple jobs at the same time, add a separate column to store a&amp;nbsp;unique identifier to identify all rows belonging to that job.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129253?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 09:15:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ce1556a4-129c-4e08-8a38-0cb026390656</guid><dc:creator>Ankush Sharma</dc:creator><description>&lt;div&gt;
&lt;div&gt;&lt;span&gt;So, I need to create a separate temporary table to store Excel data and then proceed with executing the stored procedure to populate the final table.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129251?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 08:52:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ef7d14ca-6faa-4104-8d79-abe882c9f2ef</guid><dc:creator>Ankush Sharma</dc:creator><description>&lt;p&gt;Hi &amp;nbsp;,&lt;br /&gt;&lt;br /&gt;Thanks for replying, yes i have bulk of data i don&amp;#39;t want to send at one time i want to send data in smaller batch size. I was thinking previosly that it can be handled by looping but looping will impact the performace and i think we avoid using looping over the process&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129250?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 08:49:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a9781119-a321-475e-bec9-e9f36354dc72</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Is that a one-time job? If not, how often is that import triggered? Only once at a time, or can there be multiple at the same time?&lt;/p&gt;
&lt;p&gt;In general, my best experience is: XLS-&amp;gt;Temp DB table-&amp;gt;Stored Procedure-&amp;gt;Final table.&lt;/p&gt;
&lt;p&gt;Try to avoid any looping inside Appian using expressions or processes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Want to add to the database in smaller chunks, Need to design process</title><link>https://community.appian.com/thread/129248?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 07:54:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:64ceff98-45f0-4b97-b4d8-bfd8d50cec5b</guid><dc:creator>Konduru Chaitanya</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a href="/members/ankushs0002"&gt;Ankush Sharma&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Doing the following would not put much impact on Performance.&lt;br /&gt;&lt;br /&gt;1. Get the data from your excel to a staging/temporary table&lt;/p&gt;
&lt;p&gt;2. From this temp table, create a paging and get 100 records per time in an ER and use Stored procedure and write it to the actual table.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>