Uploaded image for project: 'Hybrid Cloud Console'
  1. Hybrid Cloud Console
  2. RHCLOUD-38702

[cloud-connector] Add indexes for sql queries

XMLWordPrintable

    • 2
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • Unset
    • None

      We received a spike of messages on 03/07. The cpu load on the db was high during this time period. Looks like the database was our bottleneck during that time. Add indexes to try to speed the message processing up.

      SELECT account, org_id, dispatchers, canonical_facts, tags FROM connections WHERE (org_id = $1 OR dispatchers ? ?) AND org_id != ? AND client_id = $2

      WITH upsert AS (UPDATE connections SET dispatchers=$1, tags = $2, updated_at = NOW(), message_id = $3, message_sent = $4, org_id = $5, account = $6, tenant_lookup_timestamp = $7 , tenant_lookup_failure_count = ? WHERE client_id=$8 RETURNING *) INSERT INTO connections (account, org_id, client_id, dispatchers, canonical_facts, tags, message_id, message_sent, tenant_lookup_timestamp) SELECT $9, $10, $11, $12, $13, $14, $15, $16, $17 WHERE NOT EXISTS (SELECT * FROM upsert)

      SELECT account, org_id, client_id, dispatchers, canonical_facts, tags, message_id, message_sent FROM connections WHERE client_id = $1

      DELETE FROM connections WHERE client_id = $1

              rhn-support-dehort Derek Horton
              rhn-support-dehort Derek Horton
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: