# Having a hard time optimising

**URL:** https://meta.discourse.org/t/having-a-hard-time-optimising/359446
**Category:** Support
**Created:** [March 29, 2025, 4:45pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446 "2025-03-29T16:45:41Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Eviepayne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviepayne/32/352733_2.png) [@Eviepayne](https://meta.discourse.org/u/Eviepayne)
#### Post date: [March 29, 2025, 4:45pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/1 "2025-03-29T16:45:41Z")

</div>

Our forum underwent a large infrastructure change and now it’s not performing well.  
I migrated the database to be a managed database at digitalocean, I put S3 assets on a minio instance with cloudflare in front of it.  
I also re-deployed the discourse with a smaller vm but still enough resources to handle the load.  
from what I can see there are postgres queries that are taking forever:  
21 seconds  
 ![image](https://global.discourse-cdn.com/meta/original/4X/7/1/9/719b5d4d795611241ae171346b8dfb0ad1b8c09a.png)  
19 seconds  
 ![image](https://global.discourse-cdn.com/meta/original/4X/0/1/4/014ebfdd2e7e3b83ad9b2af6b051e31f491cc98d.png)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [March 29, 2025, 5:02pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/3 "2025-03-29T17:02:57Z")

</div>

> [@Eviepayne](#):
>
> underwent a large infrastructure change and now it’s not performing well.  
> I migrated the database to be a managed database at digitalocean

so reverse that?

though perhaps others have tried this and will chime in with tips to improve that kind of setup.

---

<div class="post-metadata">

### Author: ![Eviepayne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviepayne/32/352733_2.png) [@Eviepayne](https://meta.discourse.org/u/Eviepayne)
#### Post date: [March 29, 2025, 5:08pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/4 "2025-03-29T17:08:43Z")

</div>

Why is this unsupported?  
discourse has the options in the app.yml for external databases?  
I’m trying to scale a large server.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [March 29, 2025, 5:10pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/5 "2025-03-29T17:10:01Z")

</div>

My bad, let me remove that for now 👍

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [March 29, 2025, 5:33pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/6 "2025-03-29T17:33:57Z")

</div>

> [@Eviepayne](#):
>
> I migrated the database to be a managed database at digitalocean

How close is the managed database to your instance? Are they in the same network?

---

<div class="post-metadata">

### Author: ![Eviepayne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviepayne/32/352733_2.png) [@Eviepayne](https://meta.discourse.org/u/Eviepayne)
#### Post date: [March 29, 2025, 5:49pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/7 "2025-03-29T17:49:42Z")

</div>

yeah the server is also DO.  
right now im going to do a bone-stock install with the supported guide and import the database  
I’ll see what happens then.

---

<div class="post-metadata">

### Author: ![Eviepayne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviepayne/32/352733_2.png) [@Eviepayne](https://meta.discourse.org/u/Eviepayne)
#### Post date: [March 29, 2025, 6:00pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/8 "2025-03-29T18:00:59Z")

</div>

Is there a way to manually run those database migrations?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 29, 2025, 9:39pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/9 "2025-03-29T21:39:30Z")

</div>

> [@Eviepayne](#):
>
> I also re-deployed the discourse with a smaller vm but still enough resources to handle the load.

But it sounds like your postgres server isn’t enough to handle the load? How big is your database? How much ram does your postgres server have?

> [@Eviepayne](#):
>
> I also re-deployed the discourse with a smaller vm but still enough resources to handle the load.

Maybe you should have waited to see if your postgres server worked first?

> [@Eviepayne](#):
>
> Why is this unsupported?

Well, it’s mostly the case that only the [standard install](https://meta.discourse.org/t/142537?silent=true), is “supported.” The external database should work, but you add a bunch of variables that it’s hard to guess about.

> [@Eviepayne](#):
>
> I’m trying to scale a large server.

That’s less supported, how large? And then how large are a bunch of things? The database, the database server, the droplet you’re running on, the bandwidth between the droplet and the database. . . .

> [@Eviepayne](#):
>
> right now im going to do a bone-stock install with the supported guide and import the database

That’s a good place to start, and then you can start checking things off.

> [@Eviepayne](#):
>
> Is there a way to manually run those database migrations?

> [@Eviepayne](#):
>
> Is there a way to manually run those database migrations?

Usually it’ll happen when you bootstrap the container, but you can enter the container and

```plaintext
cd /var/www/discourse
bin/rails db:migrate

```

---

<div class="post-metadata">

### Author: ![Eviepayne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviepayne/32/352733_2.png) [@Eviepayne](https://meta.discourse.org/u/Eviepayne)
#### Post date: [March 29, 2025, 11:58pm UTC](https://meta.discourse.org/t/having-a-hard-time-optimising/359446/10 "2025-03-29T23:58:24Z")

</div>

Even a simple bare install isn’t working haven’t even restored the database at all.  
did a discourse-setup on a clean VM, and the registration isn’t working.

Attempted to restore via commandline and discourse restore doesn’t list the backups.  
Edit: worked after a second complete rebuild.
