diff --git a/backend/src/baserow/core/permission_manager.py b/backend/src/baserow/core/permission_manager.py
index 3301b56bb..3ba0f10cb 100755
--- a/backend/src/baserow/core/permission_manager.py
+++ b/backend/src/baserow/core/permission_manager.py
@@ -8,7 +8,7 @@ from baserow.core.handler import CoreHandler
 from baserow.core.integrations.operations import (
     ListIntegrationsApplicationOperationType,
 )
-from baserow.core.models import Workspace, WorkspaceUser
+from baserow.core.models import Template, Workspace, WorkspaceUser
 from baserow.core.notifications.operations import (
     ClearNotificationsOperationType,
     ListNotificationsOperationType,
@@ -134,7 +134,7 @@ class AllowIfTemplatePermissionManagerType(PermissionManagerType):
         return {
             "allowed_operations_on_templates": self.OPERATION_ALLOWED_ON_TEMPLATES,
             "workspace_template_ids": list(
-                Workspace.objects.exclude(template=None).values_list("id", flat=True)
+                Template.objects.values_list("workspace_id", flat=True)
             ),
         }
 
diff --git a/changelog/entries/unreleased/refactor/workspace_template_ids_query_performance_improvement.json b/changelog/entries/unreleased/refactor/workspace_template_ids_query_performance_improvement.json
new file mode 100644
index 000000000..79da5f352
--- /dev/null
+++ b/changelog/entries/unreleased/refactor/workspace_template_ids_query_performance_improvement.json
@@ -0,0 +1,8 @@
+{
+  "type": "refactor",
+  "message": "Workspace template IDs query performance improvement.",
+  "domain": "core",
+  "issue_number": null,
+  "bullet_points": [],
+  "created_at": "2025-03-27"
+}