<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 16:44:32 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>[OBSPROC-29] Consider efficient query for sky targets</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/OBSPROC-29</link>
                <project id="11003" key="OBSPROC">PFS observation processing/procedure</project>
                    <description>&lt;p&gt;Since the number of records of `sky` table in targetDB is so large, it takes so long to get sky targets in the process of pfsDesign generation. Consider efficient way for the query. One option is to use `q3c_radial_query`, which is used for gaiaDB.&lt;/p&gt;</description>
                <environment></environment>
        <key id="22958">OBSPROC-29</key>
            <summary>Consider efficient query for sky targets</summary>
                <type id="3" iconUrl="https://pfspipe.ipmu.jp/jira/secure/viewavatar?size=xsmall&amp;avatarId=10518&amp;avatarType=issuetype">Task</type>
                                            <priority id="10000" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/priorities/medium.svg">Normal</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="monodera">monodera</assignee>
                                    <reporter username="kiyoto.yabe">Kiyoto Yabe</reporter>
                        <labels>
                            <label>EngRun</label>
                    </labels>
                <created>Mon, 19 Sep 2022 23:59:38 +0000</created>
                <updated>Fri, 3 Mar 2023 05:04:32 +0000</updated>
                            <resolved>Fri, 3 Mar 2023 05:04:32 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                <comments>
                            <comment id="31427" author="kiyoto.yabe" created="Thu, 22 Sep 2022 14:42:23 +0000"  >&lt;p&gt;Now we fixed this using `q3c`. Could you briefly summarize what you did with the SQL commands, please? &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=monodera&quot; class=&quot;user-hover&quot; rel=&quot;monodera&quot;&gt;monodera&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=msyktnk&quot; class=&quot;user-hover&quot; rel=&quot;msyktnk&quot;&gt;Masayuki Tanaka&lt;/a&gt;&#160;mentioned that we might need to think about distributed querying using such as Citus when targetDB expands in future.&lt;/p&gt;</comment>
                            <comment id="31432" author="monodera" created="Thu, 22 Sep 2022 21:09:32 +0000"  >&lt;p&gt;&lt;tt&gt;q3c&lt;/tt&gt; was installed by Furusawa-san as an extension of PostgreSQL. After the installation, I logged into the current targetdb (currently &lt;tt&gt;targetdb_comm2022may&lt;/tt&gt; database) and executed the following SQL commands.&lt;/p&gt;

&lt;p&gt;&#160;&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;
&lt;span class=&quot;code-keyword&quot;&gt;CREATE&lt;/span&gt; EXTENSION q3c;
&lt;span class=&quot;code-keyword&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;INDEX&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;ON&lt;/span&gt; sky (q3c_ang2ipix(ra,&lt;span class=&quot;code-keyword&quot;&gt;dec&lt;/span&gt;));
&lt;span class=&quot;code-keyword&quot;&gt;CLUSTER&lt;/span&gt; sky_q3c_ang2ipix_idx &lt;span class=&quot;code-keyword&quot;&gt;ON&lt;/span&gt; sky;
&lt;span class=&quot;code-keyword&quot;&gt;ANALYZE&lt;/span&gt; sky;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;There are various functions in the q3c extension, but at this point only &lt;tt&gt;q3c_radial_query()&lt;/tt&gt; which simply returns true if (ra, dec) is in a search radius. An example query is the following.&lt;/p&gt;

&lt;p&gt;&#160;&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;
&lt;span class=&quot;code-keyword&quot;&gt;SELECT&lt;/span&gt; * &lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; {tablename} &lt;span class=&quot;code-keyword&quot;&gt;WHERE&lt;/span&gt; q3c_radial_query(ra, &lt;span class=&quot;code-keyword&quot;&gt;dec&lt;/span&gt;, {ra}, {&lt;span class=&quot;code-keyword&quot;&gt;dec&lt;/span&gt;}, {search_radius})
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Documentation can be found at the following GitHub repository.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/segasai/q3c&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://github.com/segasai/q3c&lt;/a&gt;&lt;br/&gt;
&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="31433" author="monodera" created="Thu, 22 Sep 2022 21:10:59 +0000"  >&lt;p&gt;BTW, the q3c indexing is only done in the sky table.&lt;/p&gt;</comment>
                            <comment id="31548" author="monodera" created="Thu, 6 Oct 2022 01:22:06 +0000"  >&lt;p&gt;FYI, Murata-san commented that the HSC SSP database uses the earthdistance extension in postgresql for indexing. Coord column is used as index.&lt;/p&gt;</comment>
                            <comment id="32336" author="yuki.moritani" created="Fri, 3 Mar 2023 05:04:32 +0000"  >&lt;p&gt;According to &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=monodera&quot; class=&quot;user-hover&quot; rel=&quot;monodera&quot;&gt;monodera&lt;/a&gt;&#160;efficient query was achieved by indexing with q4c. If other method needs to be used (see the above comment), it will be handled in another ticket.&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|zzsupb:</customfieldvalue>

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