QueryPerformance.constants.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. export enum QUERY_PERFORMANCE_REPORT_TYPES {
  2. MOST_TIME_CONSUMING = 'most_time_consuming',
  3. MOST_FREQUENT = 'most_frequent',
  4. SLOWEST_EXECUTION = 'slowest_execution',
  5. UNIFIED = 'unified',
  6. }
  7. export const QUERY_PERFORMANCE_PRESET_MAP = {
  8. [QUERY_PERFORMANCE_REPORT_TYPES.MOST_TIME_CONSUMING]: 'mostTimeConsuming',
  9. [QUERY_PERFORMANCE_REPORT_TYPES.MOST_FREQUENT]: 'mostFrequentlyInvoked',
  10. [QUERY_PERFORMANCE_REPORT_TYPES.SLOWEST_EXECUTION]: 'slowestExecutionTime',
  11. [QUERY_PERFORMANCE_REPORT_TYPES.UNIFIED]: 'unified',
  12. } as const
  13. export const QUERY_PERFORMANCE_COLUMNS = [
  14. { id: 'query', name: 'Query', description: undefined, minWidth: 450 },
  15. { id: 'prop_total_time', name: 'Time consumed', description: undefined, minWidth: 150 },
  16. { id: 'calls', name: 'Calls', description: undefined, minWidth: 100 },
  17. { id: 'max_time', name: 'Max time', description: undefined, minWidth: 100 },
  18. { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: 100 },
  19. { id: 'min_time', name: 'Min time', description: undefined, minWidth: 100 },
  20. { id: 'rows_read', name: 'Rows processed', description: undefined, minWidth: 130 },
  21. { id: 'cache_hit_rate', name: 'Cache hit rate', description: undefined, minWidth: 130 },
  22. { id: 'rolname', name: 'Role', description: undefined, minWidth: 200 },
  23. { id: 'application_name', name: 'Application', description: undefined, minWidth: 150 },
  24. ] as const
  25. export const QUERY_PERFORMANCE_ROLE_DESCRIPTION = [
  26. { name: 'postgres', description: 'The default Postgres role. This has admin privileges.' },
  27. {
  28. name: 'anon',
  29. description:
  30. 'For unauthenticated, public access. This is the role which the API (PostgREST) will use when a user is not logged in.',
  31. },
  32. {
  33. name: 'authenticator',
  34. description:
  35. 'A special role for the API (PostgREST). It has very limited access, and is used to validate a JWT and then "change into" another role determined by the JWT verification.',
  36. },
  37. {
  38. name: 'authenticated',
  39. description:
  40. 'For "authenticated access." This is the role which the API (PostgREST) will use when a user is logged in.',
  41. },
  42. {
  43. name: 'service_role',
  44. description:
  45. 'For elevated access. This role is used by the API (PostgREST) to bypass Row Level Security.',
  46. },
  47. {
  48. name: 'briven_auth_admin',
  49. description:
  50. 'Used by the Auth middleware to connect to the database and run migration. Access is scoped to the auth schema.',
  51. },
  52. {
  53. name: 'briven_storage_admin',
  54. description:
  55. 'Used by the Auth middleware to connect to the database and run migration. Access is scoped to the storage schema.',
  56. },
  57. { name: 'dashboard_user', description: 'For running commands via the Briven UI.' },
  58. {
  59. name: 'briven_admin',
  60. description:
  61. 'An internal role Briven uses for administrative tasks, such as running upgrades and automations.',
  62. },
  63. {
  64. name: 'pgbouncer',
  65. description:
  66. 'PgBouncer is a lightweight connection pooler for PostgreSQL. Available on paid plans only.',
  67. },
  68. ] as const
  69. export const QUERY_PERFORMANCE_CHART_TABS = [
  70. {
  71. id: 'query_latency',
  72. label: 'Query latency',
  73. },
  74. {
  75. id: 'rows_read',
  76. label: 'Rows read',
  77. },
  78. {
  79. id: 'calls',
  80. label: 'Calls',
  81. },
  82. {
  83. id: 'cache_hits',
  84. label: 'Cache hits',
  85. },
  86. ]