+
Skip to content

Single call to notification.useData results in 100+ queries to the database #27

Open
@lauri865

Description

@lauri865

We had a development environment with a hosted database, and we noticed how we somehow ploughed throught 1.5gb of egress per day per single developer only for this Cord instance.

Mind you, this database has not much data at all, mostly short testing messages:

  • 2 users
  • 13 threads
  • 77 messages
  • 24 thread participants

Seems like a single call to notification.useData from the frontend results in ~100 queries (30 queries of threads, even though the number of total threads is less) to the database, only to return 10 notifications back. On every single page load.

Now, I wonder if anyone else has witnessed this, or have we misconfigured something and missing some caching or anything else?

A single page load with an empty cord context (completely empty page, no re-renderings or anything), results in 7 queries of the below to the database:

SELECT
	"id",
	"name",
	"sharedSecret",
	"createdTimestamp",
	"customEmailTemplate",
	"enableEmailNotifications",
	"customLinks",
	"customS3Bucket",
	"segmentWriteKey",
	"customNUX",
	"iconURL",
	"type",
	"environment",
	"supportOrgID",
	"supportBotID",
	"supportSlackChannelID",
	"redirectURI",
	"customerID",
	"slackConnectAllOrgs",
	"eventWebhookURL",
	"eventWebhookSubscriptions",
	"customSlackAppID",
	"customSlackAppDetails"
FROM
	"cord"."applications" AS "ApplicationEntity"
WHERE
	"ApplicationEntity"."id" = 'REDACTED'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载