<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 16:21:10 JST 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>PFS-JIRA</title>
    <link>https://pfspipe.ipmu.jp/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.3.4</version>
        <build-number>803005</build-number>
        <build-date>13-09-2019</build-date>
    </build-info>


<item>
            <title>[INSTRM-66] archiver startup is slow</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/INSTRM-66</link>
                <project id="10300" key="INSTRM">Instrument control development</project>
                    <description>&lt;p&gt;The archiver takes a long time to start, evidently because of checking/crawling all the existing rows. At LAM, the raw tables have ~170M rows:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;2017-01-05 17:31:36+0000  Log opened.&lt;br/&gt;
2017-01-05 17:31:36+0000  importing postgres dbapi module psycopg2&lt;br/&gt;
2017-01-05 17:31:36+0000  database: table enu__slit contains 1 rows&lt;br/&gt;
2017-01-05 17:33:50+0000  database: table reply_raw contains 170736146 rows&lt;br/&gt;
2017-01-05 17:35:06+0000  database: table reply_hdr contains 170686655 rows&lt;br/&gt;
2017-01-05 17:35:06+0000  database: table hub__commanders contains 104527 rows&lt;br/&gt;
2017-01-05 17:35:06+0000  database: table hub__users contains 104526 rows&lt;br/&gt;
2017-01-05 17:35:06+0000  database: table actors contains 44 rows&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;It is not clear whether that scan is necessary. If not perhaps we can remove it. If it is, perhaps we need to use a union database or something.&lt;/p&gt;
</description>
                <environment></environment>
        <key id="11417">INSTRM-66</key>
            <summary>archiver startup is slow</summary>
                <type id="3" iconUrl="https://pfspipe.ipmu.jp/jira/secure/viewavatar?size=xsmall&amp;avatarId=10518&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/priorities/major.svg">Major</priority>
                        <status id="10002" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/statuses/generic.png" description="The issue is resolved, reviewed, and merged">Done</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="arnaud.lefur">arnaud.lefur</assignee>
                                    <reporter username="cloomis">cloomis</reporter>
                        <labels>
                    </labels>
                <created>Thu, 5 Jan 2017 17:48:21 +0000</created>
                <updated>Mon, 2 Jul 2018 19:24:14 +0000</updated>
                            <resolved>Mon, 2 Jul 2018 19:24:12 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                <comments>
                            <comment id="12196" author="arnaud.lefur" created="Tue, 23 May 2017 10:32:46 +0000"  >&lt;p&gt; &lt;b&gt;&quot;select count&lt;img class=&quot;emoticon&quot; src=&quot;https://pfspipe.ipmu.jp/jira/images/icons/emoticons/star_yellow.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; from %s&quot; % tableName&quot;&lt;/b&gt; is really slow with a billion row.&lt;br/&gt;
But it appears that&apos;s not really necessary to do it every single tables.&lt;/p&gt;

&lt;p&gt;However it&apos;s required for &lt;em&gt;reply_raw&lt;/em&gt;, and &lt;em&gt;reply_hdr&lt;/em&gt;, in that case, i&apos;m just taking the last row_id, and it seems ok.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/Subaru-PFS/ics_archiver/commit/ea01a7421cba16da3054e7ac3d0d3316191ca266&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://github.com/Subaru-PFS/ics_archiver/commit/ea01a7421cba16da3054e7ac3d0d3316191ca266&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;ll merge later, if it&apos;s fine.&lt;/p&gt;
</comment>
                            <comment id="12199" author="atsushi.shimono" created="Tue, 23 May 2017 12:21:15 +0000"  >&lt;p&gt;Or if it is int/bigint type, you could use MAX() instead of??&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;In pgsql, count&lt;img class=&quot;emoticon&quot; src=&quot;https://pfspipe.ipmu.jp/jira/images/icons/emoticons/star_yellow.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; could be quite slow if index only scan is not enabled, due to MVCC... (I don&apos;t have clear idea that MAX() can solve this,,, sorry.)&lt;/li&gt;
&lt;/ol&gt;
</comment>
                            <comment id="12201" author="cloomis" created="Tue, 23 May 2017 14:47:25 +0000"  >&lt;p&gt;I agree with using MAX():&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-sql&quot;&gt;

archiver=# &lt;span class=&quot;code-keyword&quot;&gt;explain&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;count&lt;/span&gt;(id) &lt;span class=&quot;code-keyword&quot;&gt;from&lt;/span&gt; reply_raw;
                                 QUERY &lt;span class=&quot;code-keyword&quot;&gt;PLAN&lt;/span&gt;
&lt;span class=&quot;code-comment&quot;&gt;----------------------------------------------------------------------------
&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Aggregate&lt;/span&gt;  (cost=1695406.31..1695406.32 &lt;span class=&quot;code-keyword&quot;&gt;rows&lt;/span&gt;=1 width=8)
   -&amp;gt;  Seq Scan &lt;span class=&quot;code-keyword&quot;&gt;on&lt;/span&gt; reply_raw  (cost=0.00..1533464.05 &lt;span class=&quot;code-keyword&quot;&gt;rows&lt;/span&gt;=64776905 width=8)
(2 &lt;span class=&quot;code-keyword&quot;&gt;rows&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;versus:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-sql&quot;&gt;
archiver=# &lt;span class=&quot;code-keyword&quot;&gt;explain&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;max&lt;/span&gt;(id) &lt;span class=&quot;code-keyword&quot;&gt;from&lt;/span&gt; reply_raw;
                                                       QUERY &lt;span class=&quot;code-keyword&quot;&gt;PLAN&lt;/span&gt;
&lt;span class=&quot;code-comment&quot;&gt;-------------------------------------------------------------------------------------------------------------------------
&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Result&lt;/span&gt;  (cost=0.61..0.62 &lt;span class=&quot;code-keyword&quot;&gt;rows&lt;/span&gt;=1 width=0)
   InitPlan 1 (&lt;span class=&quot;code-keyword&quot;&gt;returns&lt;/span&gt; $0)
     -&amp;gt;  &lt;span class=&quot;code-keyword&quot;&gt;Limit&lt;/span&gt;  (cost=0.56..0.61 &lt;span class=&quot;code-keyword&quot;&gt;rows&lt;/span&gt;=1 width=8)
           -&amp;gt;  &lt;span class=&quot;code-keyword&quot;&gt;Index&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Only&lt;/span&gt; Scan &lt;span class=&quot;code-keyword&quot;&gt;Backward&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;using&lt;/span&gt; reply_raw_pkey &lt;span class=&quot;code-keyword&quot;&gt;on&lt;/span&gt; reply_raw  (cost=0.56..2732366.40 &lt;span class=&quot;code-keyword&quot;&gt;rows&lt;/span&gt;=64776905 width=8)
                 &lt;span class=&quot;code-keyword&quot;&gt;Index&lt;/span&gt; Cond: (id &lt;span class=&quot;code-keyword&quot;&gt;IS&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;NULL&lt;/span&gt;)
(5 &lt;span class=&quot;code-keyword&quot;&gt;rows&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note that we should perhaps be using postgresql&apos;s `BIGSERIAL` type for the ids. Probably does not matter for single-writer tables. But it does make the monotonically increasing integer constraint explicit.&lt;/p&gt;</comment>
                            <comment id="12202" author="atsushi.shimono" created="Tue, 23 May 2017 15:00:43 +0000"  >&lt;p&gt;Due to MVCC used by pgsql, you need to use some trick or configuration to get rid from seq scan into index only scan for count(xxx). For just getting max number from auto_increment-ish column, the easiest way in pgsql is max()...&lt;/p&gt;</comment>
                            <comment id="12203" author="arnaud.lefur" created="Tue, 23 May 2017 15:08:21 +0000"  >&lt;p&gt;Yes, I should have used max(), what I did is equivalent but not very clean.&lt;/p&gt;</comment>
                            <comment id="12355" author="atsushi.shimono" created="Tue, 27 Jun 2017 17:03:26 +0000"  >&lt;p&gt;&lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=arnaud.lefur&quot; class=&quot;user-hover&quot; rel=&quot;arnaud.lefur&quot;&gt;arnaud.lefur&lt;/a&gt; close this?&lt;/p&gt;</comment>
                            <comment id="13720" author="cloomis" created="Mon, 2 Jul 2018 19:24:14 +0000"  >&lt;p&gt;This has been fixed for a year.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10500" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|ii01h3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>