Postgres processes not finishing


#1

Has anyone else experienced issues with postgres processes hanging causing CPU to spike. When i look in the DB there are several queries like the one below which are not completing.

16988 | redash | redash | SELECT dashboards.updated_at AS dashboards_updated_at, dashboards.created_at AS dashboards_created_at, dashboards.id AS dashboards_id, dashboards.version AS dashboards_version, dashboards.org_id AS dashboards_org_id, dashboards.slug AS dashboards_slug, dashboards.name AS dashboards_name, dashboards.user_id AS dashboards_user_id, dashboards.layout AS dashboards_layout, dashboards.dashboard_filters_enabled AS dashboards_dashboard_filters_enabled, dashboards.is_archived AS dashboards_is_archived, dashboards.is_draft AS dashboards_is_draft +
| | | FROM dashboards LEFT OUTER JOIN events ON dashboards…id = CAST(events.object_id AS INTEGER) LEFT OUTER JOIN widgets ON dashboards…id = widgets.dashboard_id LEFT OUTER JOIN visualizations ON visualizations…id = widgets.visualization_id LEFT OUTER JOIN queries ON queries…id = visualizations.query_id LEFT OUTER JOIN data_source_groups ON queries.data_source_id = data_source_groups.data_source_id +
| | | WHERE events.created_at > CURRENT_DATE - 7 AND events.action IN (‘edit’, ‘view’) AN


#2

It might be that your events table grew too large. Check how big it is and if needed clean it up.


#3

Yep, that was it. Events table was 1745289216. I’ll have to write something to just keep 1 weeks worth of data.

Thanks!


#4

I think that it’s something we should have in the software as you’re probably not the only one being hit by this.