Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregation schema design for period and buckets #428

Closed
sts-ryan-holton opened this issue Dec 11, 2024 · 1 comment
Closed

Aggregation schema design for period and buckets #428

sts-ryan-holton opened this issue Dec 11, 2024 · 1 comment

Comments

@sts-ryan-holton
Copy link

Pulse Version

Latest

Laravel Version

Latest

PHP Version

Latest

Livewire Version

Latest

Database Driver & Version

No response

Description

Hi, I’m hoping that @jessarcher might be able to assist with this given that the behind the scenes for Pulse has been released on YouTube.

I’m trying to aggregate data in my application by day, hour and minute. I have three tables, one for daily aggregates, one for hourly and one for minutely.

The schema in each table is identical where there’s a unique index across several foreign id columns that link to other models, followed by an integer stat column, for example, “total_leads” and a date time column, where in each table this date time column would look like:

  • Daily table: 2024-01-01
  • Hourly table: 2024-01-01 13:00:00
  • Minutely table: 2024-01-01 13:01:00

The idea is that there would be one for for the day table, up to 24 rows for the hour table, and 1440 rows for the minute table.

each table is using ‘firstOrCreate’ to get the unique row and increment the data.

But found the problem that when filtering a complex UI that has a datetime picker “from” and “to” that it wouldn’t be able to sum rows across tables, for instance when going slightly over a window, like 13:00:00 to 14:05:00

Steps To Reproduce

I’m trying to fully understand then whether, in Pulse’s case, is this why everything is stored in the aggregates table, and the period column grabs all periods whereby the current datetime matches N, and how the timestamp is used with this and why not just a datetime used?

any advice / guidance?

@crynobone
Copy link
Member

Hi there,

Thanks for reporting the problem you are encountering, but it looks like this is a question which may be better suited for a support channel. We only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repository you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants