Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXRTW-0001Cj-Cy for pgsql-general@arkaria.postgresql.org; Mon, 04 Oct 2021 17:10:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mXRTV-0000t5-CN for pgsql-general@arkaria.postgresql.org; Mon, 04 Oct 2021 17:10:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXRTU-0000sr-V3 for pgsql-general@lists.postgresql.org; Mon, 04 Oct 2021 17:10:01 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mXRTS-0001Pi-Ht for pgsql-general@postgresql.org; Mon, 04 Oct 2021 17:10:00 +0000 Received: by mail-pj1-x102a.google.com with SMTP id d13-20020a17090ad3cd00b0019e746f7bd4so4426338pjw.0 for ; Mon, 04 Oct 2021 10:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alaska.edu; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=h6d1R9JixNy4egeJcaLj/cwdw+t+FZ9ZV2QVoOmDl7s=; b=iTpoUWYlGRe+0meg4xMCjnlH5uwrBJZkjNy8Ez214CWycmXUM2k45wcFpnzUlbGrDE E1MGuOIH4m6jgoPb84jRF+wN82/I+WJuNiAUbQzX25KkKJlLwd/D5bjAbWSVwY83x2KU MEVh5QvaxgpnlDlUobYVETM2yJ8f5Jte/r2XHTl0NTTizL/TOUxTxmXK3ipg3bGHQX9r usTwxDiSEuU3sGAY2JtlY3TSG5f+SRo4a51MWkMvVMTRBwBXmL/bScECyglAPtoPrwu+ BTWHEiG8RwIUY+9FgnE9c0xRShKtAFRa3ZlFndBChv8hows4iWOwM7gNKkIskhynNBTc eZWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=h6d1R9JixNy4egeJcaLj/cwdw+t+FZ9ZV2QVoOmDl7s=; b=nzdZixWk9ph56riZTkVG6nnW2cAcPOTG/1FFXXUHr7VN+wiFkXJ41GIl/I6XXnTTYf VOyf9iC85Kx63Xke5TRus8RMjC81UvpMK6be32qWecL4o+EQ7iih+IJtFo8CX6f+GIL4 PXm5m5+G5rEJp059nMtn9q5SaF9O8KBZL/mE54JX+ARlYN52RN1gP+A+z4XjdAZI53wg IRmGgTLQ3+fnrA+zh0Ka8Kw76rBNWoa7atcTSRHHdP/nbdl/MTWOHY4BLIph/9HcLPCQ GS9cSmQ6TdRYiq3gI+tqeouN4G5QNljk7e00qmZ0uCCXFLzVyD0mQE8IGO1ViQXvG7Qv hJHg== X-Gm-Message-State: AOAM530KAZLUQffRrpKKq1eEBU60KcbxZnpJLr0T+YDrMUQ52m5ytK0N fDbtgjTubvLhxzNREdiLaamwhQ== X-Google-Smtp-Source: ABdhPJxjmp0qeE8r5beDZNOpttwgmqPflcLN9jVadiEidzRXTgyFh9vNRWo1pOYD6Y1Ma61CzDSnZQ== X-Received: by 2002:a17:902:bf0a:b0:13d:f4b8:111 with SMTP id bi10-20020a170902bf0a00b0013df4b80111mr706939plb.35.1633367396903; Mon, 04 Oct 2021 10:09:56 -0700 (PDT) Received: from [10.27.81.2] (191-92-174-206.gci.net. [206.174.92.191]) by smtp.gmail.com with ESMTPSA id s37sm5914256pfg.44.2021.10.04.10.09.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Oct 2021 10:09:56 -0700 (PDT) From: Israel Brewster Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_3761A602-19D7-44D9-A8EC-09E27773FFC6" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Growth planning Date: Mon, 4 Oct 2021 09:09:54 -0800 In-Reply-To: <39A75BC4-7F4D-45F9-BD66-891F0294A072@gmail.com> Cc: "pgsql-general@postgresql.org" To: Rob Sargent References: <35170FC5-0A05-48F3-9ED1-F007CC1AF365@alaska.edu> <39A75BC4-7F4D-45F9-BD66-891F0294A072@gmail.com> X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_3761A602-19D7-44D9-A8EC-09E27773FFC6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 4, 2021, at 8:46 AM, Rob Sargent wrote: >=20 >> On Oct 4, 2021, at 10:22 AM, Israel Brewster > wrote: > Guessing the =E2=80=9Csd=E2=80=9D is "standard deviation=E2=80=9D? = Any chance those stddevs are easily calculable from base data? Could = cut your table size in half (and put those 20 cores to work on the = reporting). Possible - I=E2=80=99d have to dig into that with the script author. I = was just handed an R script (I don=E2=80=99t work with R=E2=80=A6) and = told here=E2=80=99s the data it needs, here=E2=80=99s the output we need = stored in the DB. I then spent just enough time with the script to = figure out how to hook up the I/O. The schema is pretty much just a raw = dump of the output - I haven=E2=80=99t really spent any resources = figuring out what, exactly, the data is. Maybe I should :-) > And I wonder if the last three indices are strictly necessary? They = take disc space too. Not sure. Here=E2=80=99s the output from pg_stat_all_indexes: volcano_seismology=3D# select * from pg_stat_all_indexes where = relname=3D'data'; relid | indexrelid | schemaname | relname | indexrelname | = idx_scan | idx_tup_read | idx_tup_fetch=20 = -------+------------+------------+---------+---------------------------+--= --------+--------------+--------------- 19847 | 19869 | public | data | data_pkey | = 0 | 0 | 0 19847 | 19873 | public | data | date_station_channel_idx | = 811884 | 12031143199 | 1192412952 19847 | 19875 | public | data | station_channel_epoch_idx | = 8 | 318506 | 318044 19847 | 19876 | public | data | station_data_idx | = 9072 | 9734 | 1235 19847 | 19877 | public | data | station_date_idx | = 721616 | 10927533403 | 10908912092 19847 | 20479 | public | data | data_station_channel_idx | = 47293 | 194422257262 | 6338753379 (6 rows) so they *have* been used (although not the station_data_idx so much), = but this doesn=E2=80=99t tell me when it was last used, so some of those = may be queries I was experimenting with to see what was fastest, but are = no longer in use. Maybe I should keep an eye on this for a while, see = which values are increasing. >=20 > But my bet is you=E2=80=99re headed for partitioning on datetime or = perhaps station. While datetime partitioning seems to be the most common, I=E2=80=99m not = clear on how that would help here, as the most intensive queries need = *all* the datetimes for a given station, and even the smaller queries = would be getting an arbitrary time range potentially spanning several, = if not all, partitions. Now portioning on station seems to make sense - = there are over 100 of those, and pretty much any query will only deal = with a single station at a time. Perhaps if more partitioning would be = better, portion by both station and channel? The queries that need to be = fastest will only be looking at a single channel of a single station. I=E2=80=99ll look into this a bit more, maybe try some experimenting = while I still have *relatively* little data. My main hesitation here is = that in the brief look I=E2=80=99ve given partitioning so far, it looks = to be a royal pain to get set up. Any tips for making that easier? Thanks for the suggestion! --- Israel Brewster Software Engineer Alaska Volcano Observatory=20 Geophysical Institute - UAF=20 2156 Koyukuk Drive=20 Fairbanks AK 99775-7320 Work: 907-474-5172 cell: 907-328-9145= --Apple-Mail=_3761A602-19D7-44D9-A8EC-09E27773FFC6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On = Oct 4, 2021, at 8:46 AM, Rob Sargent <robjsargent@gmail.com> wrote:

On Oct 4, 2021, at 10:22 AM, = Israel Brewster <ijbrewster@alaska.edu> = wrote:
Guessing the =E2=80=9Csd=E2=80=9D is "standard = deviation=E2=80=9D?  Any chance those stddevs are easily calculable = from base data?  Could cut your table size in half (and put those = 20 cores to work on the = reporting).

Possible - I=E2=80=99d have to dig into that with = the script author. I was just handed an R script (I don=E2=80=99t work = with R=E2=80=A6) and told here=E2=80=99s the data it needs, here=E2=80=99s= the output we need stored in the DB. I then spent just enough time with = the script to figure out how to hook up the I/O. The schema is pretty = much just a raw dump of the output - I haven=E2=80=99t really spent any = resources figuring out what, exactly, the data is. Maybe I should = :-)

=  And I wonder if the last three indices are strictly necessary? = They take disc space too.

Not sure. Here=E2=80=99s the output from = pg_stat_all_indexes:

volcano_seismology=3D# select * from = pg_stat_all_indexes where relname=3D'data';
 relid | = indexrelid | schemaname | relname |     =   indexrelname        | idx_scan | = idx_tup_read | idx_tup_fetch 
-------+------------+------------+---------+-------------------= --------+----------+--------------+---------------
 19847 |      19869 | = public     | data    | = data_pkey               =   |        0 |      =       0 |           =   0
 19847 |      19873 = | public     | data    | = date_station_channel_idx  |   811884 = |  12031143199 |    1192412952
 19847 |      19875 | = public     | data    | = station_channel_epoch_idx |        8 = |       318506 |      =   318044
 19847 |    =   19876 | public     | data  =   | station_data_idx        =   |     9072 |       =   9734 |          1235
 19847 |      19877 | = public     | data    | = station_date_idx        =   |   721616 |  10927533403 = |   10908912092
 19847 |    =   20479 | public     | data  =   | data_station_channel_idx  |  =   47293 | 194422257262 |    6338753379
(6 rows)

so they = *have* been used (although not the station_data_idx so much), but this = doesn=E2=80=99t tell me when it was last used, so some of those may be = queries I was experimenting with to see what was fastest, but are no = longer in use. Maybe I should keep an eye on this for a while, see which = values are increasing.


But my bet is you=E2=80=99= re headed for partitioning on datetime or perhaps = station.

While datetime partitioning seems to be the most = common, I=E2=80=99m not clear on how that would help here, as the most = intensive queries need *all* the datetimes for a given station, and even = the smaller queries would be getting an arbitrary time range potentially = spanning several, if not all, partitions. Now portioning on station = seems to make sense - there are over 100 of those, and pretty much any = query will only deal with a single station at a time. Perhaps if more = partitioning would be better, portion by both station and channel? The = queries that need to be fastest will only be looking at a single channel = of a single station.

I=E2=80=99ll = look into this a bit more, maybe try some experimenting while I still = have *relatively* little data. My main hesitation here is that in the = brief look I=E2=80=99ve given partitioning so far, it looks to be a = royal pain to get set up. Any tips for making that easier?

Thanks for the = suggestion!
---
Israel Brewster
Software= Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk = Drive 
Fairbanks AK 99775-7320
Work: = 907-474-5172
cell: =  907-328-9145
= --Apple-Mail=_3761A602-19D7-44D9-A8EC-09E27773FFC6--