<div dir="ltr"><div><div><div><div><div><div><div>Thanks for the help!<br><br></div>I originally tried putting everything into a single non-partitioned table but the performance was horrible! Since each set of 2.3M rows shares the same timestamp, I thought this would be a good way to divide up the data when partitioning - I set a constraint on each, e.g. <br><br>table 1: constraint: timeid=101<br>table 2: constraint: timeid=102<br>etc.<br><br></div>I could try grouping times into a single table, e.g.<br><br>table 1: constraint: 100 <= timeid < 110<br>table 2: constraint: 110 <= timeid < 120<br></div>etc.<br><br></div>so that would give me 1000 partitions of 24 million rows each.<br><br></div>Is this what you were suggesting? What do you think the optimal balance of partitions and rows would be? 100 partitions of 240 million rows each? 10 partitions of 2.4 billion rows each? At some point I think I would run into the insufferable performance I was getting with a single table, though.<br><br></div><div>Actually, now that I check the number of partitions is closer to 17,000, and number of rows per is 2.7M, so 46 billion rows altogether...<br></div><div><br></div>Thanks again!<br></div>-Andy<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 31, 2017 at 6:15 PM, Andy Colson <span dir="ltr"><<a href="mailto:andy@squeakycode.net" target="_blank">andy@squeakycode.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/31/2017 11:38 AM, Andrew Gaydos wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
<br>
<br>
My questions are<br>
<br>
 1. It seems that for every session, there is a one-time penalty for the first query (several minutes) after which queries tend to run much quicker (about 10 seconds for all the tiles to be served). What is going on here?<br>
 2. Is there a way to optimize GeoServer's queries against this schema, or a more efficient query to try?<br>
 3. other postgres optimizations that might help?<br>
<br>
I'm pretty new to both GeoServer and PostGIS and have a sinking feeling that I could be structuring this dataset and queries more efficiently, but I've run out of ideas and don't have any postgres experts at work to ask, so I'm posting here.<br>
<br>
Thanks for any insight!<br>
<br>
-Andy<br>
</blockquote>
<br>
Andy's Unite!<br>
<br>
err.. anyway, Here is the problem:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
data table: (10,000 partitions, each with 2.3 million rows)<br>
</blockquote>
<br>
<br>
Lots of partitions will kill planning time. Look at the very bottom of:<br>
<a href="https://www.postgresql.org/docs/9.5/static/ddl-partitioning.html" rel="noreferrer" target="_blank">https://www.postgresql.org/doc<wbr>s/9.5/static/ddl-partitioning.<wbr>html</a><br>
<br>
Do you have your heart set on lots of partitions?  How'd you feel about 100? or maybe 1000?<br>
<br>
-Andy<br>
______________________________<wbr>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/postgis-users</a></blockquote></div><br></div>