Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
TimescaleDB GROUP BY of time_bucket in view of view not working

PostgreSQL: 13.4
TimescaleDB: 2.4.2

When creating a view that is based on an existing view I cannot GROUP BY a time_bucket field. In the following example you can see three rows each at 20:00:00, those should be one row with the traffic tallied up. The 5min View does that as intended for the raw data.

As an example, here I tally the traffic in a 5min time_bucket (irrelevant data omitted from pictures):

enter image description here

With:

CREATE MATERIALIZED VIEW wifi_traffic_5m
WITH (timescaledb.continuous)
AS
    SELECT
        time_bucket('5 minutes', "timestamp") AS bucket_time,
        clientid,
        customer,
        devicecpuid,
        SUM(traffic) AS traffic
    FROM ht_wifi_traffic_processed
    GROUP BY bucket_time, clientid, customer, devicecpuid

Now I wanted to create a 15min view based on the 5min view, but I get this result:

enter image description here

With:

CREATE VIEW wifi_traffic_15m
AS
    SELECT
        time_bucket('15 minutes', bucket_time) AS bucket_time,
        clientid,
        customer,
        devicecpuid,
        SUM(traffic) AS traffic
    FROM wifi_traffic_5m
    GROUP BY bucket_time, clientid, customer, devicecpuid
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Well shortly after posting the question I found the solution myself. The name of the time bucket cannot be the same in both views.

If I edit the second view as follows:

CREATE VIEW wifi_traffic_15m
AS
    SELECT
        time_bucket('15 minutes', bucket_time) AS new_bucket_time,
        clientid,
        customer,
        devicecpuid,
        SUM(traffic) AS traffic
    FROM wifi_traffic_5m
    GROUP BY new_bucket_time, clientid, customer, devicecpuid

It works as intended.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda