<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Jakob,</p>
<p>Thank you for this additional information. With this at hand, I am cc'ing Matthias and Nyall - both of them much more knowledgeable about the internals of QGIS with respect to relations and PostgreSQL.</p>
<p>I know that Matthias is working on improving the performance of relations and their corresponding relation widgets - but I am not sure if the work is only in the master branch (QGIS 3.x) or already in 2.18. @Matthias can you please have a look at this thread and comment?</p>
<p>The table sizes you mention are perhaps larger than average, but QGIS should be able to handle them. If not, I consider it a bug or an issue.</p>
<p>If you have the opportunity to test the same setup in a QGIS 3 nightly, I would be interested if the situation improved over QGIS 2.18. You can get the latest QGIS 2.99 (3x) version by running the OSGEO4W installer (see <a href="http://www.qgis.org/en/site/forusers/alldownloads.html#windows">http://www.qgis.org/en/site/forusers/alldownloads.html#windows</a>) and choosing qgis-dev. This can be installed in parallel with 2.18 on a production system.</p>
<p>If you want something that works NOW with 2.18 - it may be worth testing the "Data Driven Input Mask" that Bernhard mentioned. This should do all the "heavy" stuff definitely in the database, and not on the client. See <a href="http://plugins.qgis.org/plugins/DataDrivenInputMask/">http://plugins.qgis.org/plugins/DataDrivenInputMask/</a></p>
<p>I hope that Matthias and/or Nyall can comment more on the issue.</p>
<p>Andreas</p>
<p>On 2017-08-09 09:32, Jakob Miksch wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --> <!-- head ignored --><!-- meta ignored --> <!-- meta ignored -->
<div class="WordSection1">
<p class="MsoNormal"><span style="color: windowtext;">Hello,<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">thanks for the response!<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">## What means "big" (how many records are you dealing with)?<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">These are the sizes (number of records) of the main tables:<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">- location (points) ~ 450 000<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">- event ~ 150 000<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">- occurrence ~ 270 000<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">## I know this sounds silly - but are your tables properly indexed (you<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">don't have to index primary keys, but other columns that are used in<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">relations need an index)<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">There are indexes for the foreign keys of the main tables. Also all "controlled vocabulary" columns are indexed.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">Th referencing tables are usually smaller than 500 records.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">## What exact QGIS version are you using? 2.18.x - in the about dialogue<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">you can find this, including the exact github version string<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">I tried it with:<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">- Ubuntu 16.04 (in virtual machine on Windows 10): 2.18.11 https://github.com/qgis/QGIS/commit/29548e7<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">- Windows 10: 2.18.11 https://github.com/qgis/QGIS/commit/29548e7<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">## How I set everything up<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">I created "relations" (location-event and event-occurrence) in the project properties.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">In the "fields" tab of the layers properties I also changed respective "edit widgets" to "Relation Reference".<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">For the controlled vocabulary I changed the "edit widgets" to "Value Relation" (I used the Autoform plugin https://github.com/sourcepole/AutoForm for it and checked it manually)<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">I kept "Attribute editor layout" with the "Autogenerate" setting.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">## What I want to have:<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">I want to be able to add new events (and occurrences) to locations.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">## What happens:<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">When I want to create a new **location**, I have to wait for a few minutes. Then the input window pops up, but I cannot access it because QGIS has frozen.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">When I want to create a new **event**, an empty window opens, QGIS freezes and nothing happens for many minutes.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">When I want to create a new **occurrence**, the table opens slowly, but I can enter all necessary values and store it to the database.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">## Question:<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">Can QGIS handle tables of the sizes mentioned above?<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">Do you have an idea, what I could have done wrong?<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">I could also provide more information and maybe even a minimal example.<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;"><!-- o ignored --> </span></p>
<p class="MsoNormal"><span style="color: windowtext;">Thanks and best regards,<!-- o ignored --></span></p>
<p class="MsoNormal"><span style="color: windowtext;">Jakob<!-- o ignored --></span></p>
<p class="MsoNormal"><!-- o ignored --> </p>
<div>
<div style="border: none; border-top: solid #E1E1E1 1.0pt; padding: 3.0pt 0cm 0cm 0cm;">
<p class="MsoNormal"><strong><span style="color: windowtext; mso-fareast-language: NO-BOK;">From:</span></strong><span style="color: windowtext; mso-fareast-language: NO-BOK;"> Qgis-user [mailto:qgis-user-bounces@lists.osgeo.org] <strong>On Behalf Of </strong>Andreas Neumann<br /> <strong>Sent:</strong> fredag 4. august 2017 09.39<br /> <strong>To:</strong> qgis-user@lists.osgeo.org<br /> <strong>Subject:</strong> Re: [Qgis-user] QGIS Input Form for PostGIS<!-- o ignored --></span></p>
</div>
</div>
<p class="MsoNormal"><!-- o ignored --> </p>
<p>Hi Jakob,<span style="font-size: 12.0pt; mso-fareast-language: NO-BOK;"><!-- o ignored --></span></p>
<p>I don't think there is much background information or documentation available on relations.<!-- o ignored --></p>
<p>The obvious questions to you are:<!-- o ignored --></p>
<p>- What means "big" (how many records are you dealing with)?<!-- o ignored --></p>
<p>- I know this sounds silly - but are your tables properly indexed (you don't have to index primary keys, but other columns that are used in relations need an index)<!-- o ignored --></p>
<p>- What exact QGIS version are you using? 2.18.x - in the about dialogue you can find this, including the exact github version string<!-- o ignored --></p>
<p>- if we can't help you further, it may help to see your create table statements (including all indexes)<!-- o ignored --></p>
<p>Andreas<!-- o ignored --></p>
<p class="MsoNormal"><!-- o ignored --> </p>
<div>
<p class="MsoNormal">On 03.08.2017 11:47, Jakob Miksch wrote:<!-- o ignored --></p>
</div>
<blockquote style="margin-top: 5.0pt; margin-bottom: 5.0pt;">
<p class="MsoNormal"><span>Hello,</span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>I have a (rather big) Postgres/PostGIS database that basically looks like this: <a href="https://ibb.co/bK7PKv">https://ibb.co/bK7PKv</a></span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>I want to use QGIS for editing and inserting data.</span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>I already found these ressources:</span><!-- o ignored --></p>
<p class="MsoNormal"><span><a href="https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/vector_properties.html#fields-properties">https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/vector_properties.html#fields-properties</a></span><!-- o ignored --></p>
<p class="MsoNormal"><span><a href="https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/attribute_table.html#creating-one-or-many-to-many-relations">https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/attribute_table.html#creating-one-or-many-to-many-relations</a></span><!-- o ignored --></p>
<p class="MsoNormal"><span><a href="https://docs.qgis.org/2.18/en/docs/training_manual/create_vector_data/forms.html">https://docs.qgis.org/2.18/en/docs/training_manual/create_vector_data/forms.html</a></span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>I tried it: I created the relations and built custom forms.</span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>However, when I want to insert or edit something. QGIS becomes really slow and crashes finally. But before I describe the problems in more detail I want to read more about it. I find the documentation (linked above) a bit too little. </span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>So, my question:</span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>Is there any documentation I have missed?</span><!-- o ignored --></p>
<p class="MsoNormal"><span>Is there any book (chapter) you can recommend?</span><!-- o ignored --></p>
<p class="MsoNormal"><span>Do you know of any example where QGIS is used for entering data into many related tables in Postgres/PostGIS at once?</span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal"><span>I am thankful for any hint or resource.</span><!-- o ignored --></p>
<p class="MsoNormal"><span> </span><!-- o ignored --></p>
<p class="MsoNormal">Jakob<!-- o ignored --></p>
<p class="MsoNormal"><span style="font-size: 12.0pt; font-family: 'Times New Roman',serif; mso-fareast-language: NO-BOK;"><br /> <br /> <br /> <!-- o ignored --></span></p>
<pre>_______________________________________________<!-- o ignored --></pre>
<pre>Qgis-user mailing list<!-- o ignored --></pre>
<pre><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><!-- o ignored --></pre>
<pre>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><!-- o ignored --></pre>
<pre>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><!-- o ignored --></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size: 12.0pt; font-family: 'Times New Roman',serif; mso-fareast-language: NO-BOK;"><!-- o ignored --> </span></p>
</div>
</blockquote>
<p><br /></p>

</body></html>