ob_admin_database.sql 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. drop table if exists ob_admin.public.query_stats;
  2. drop table if exists ob_admin.public.client_query_stats;
  3. drop table if exists ob_admin.public.insert_stats;
  4. create table if not exists ob_admin.public.query_stats
  5. (
  6. agg_begin_at timestamp not null,
  7. agg_end_at timestamp not null,
  8. created_at timestamp not null,
  9. cnt bigint not null,
  10. query text not null,
  11. avg_read_rows bigint default -1,
  12. max_read_rows bigint default -1,
  13. avg_read_bytes bigint default -1,
  14. max_read_bytes bigint default -1,
  15. avg_result_rows bigint default -1,
  16. max_result_rows bigint default -1,
  17. avg_result_bytes bigint default -1,
  18. max_result_bytes bigint default -1,
  19. avg_du bigint default -1,
  20. max_du bigint default -1,
  21. db varchar(64) [],
  22. client varchar(128) default '',
  23. query_hash decimal(20, 0) not null
  24. );
  25. create table if not exists ob_admin.public.insert_stats
  26. (
  27. agg_begin_at timestamp not null,
  28. agg_end_at timestamp not null,
  29. created_at timestamp not null,
  30. cnt bigint not null,
  31. query text not null,
  32. avg_wrows bigint default -1,
  33. max_wrows bigint default -1,
  34. avg_wbytes bigint default -1,
  35. max_wbytes bigint default -1,
  36. avg_du bigint default -1,
  37. max_du bigint default -1,
  38. client varchar(128) default '',
  39. query_hash decimal(20, 0) not null
  40. );
  41. create table if not exists ob_admin.public.client_query_stats
  42. (
  43. agg_begin_at timestamp not null,
  44. agg_end_at timestamp not null,
  45. created_at timestamp not null,
  46. cnt bigint not null,
  47. query text not null,
  48. avg_rrows bigint default -1,
  49. max_rrows bigint default -1,
  50. avg_rbytes bigint default -1,
  51. max_rbytes bigint default -1,
  52. avg_du bigint default -1,
  53. max_du bigint default -1,
  54. client varchar(128) default ''
  55. );
  56. truncate table ob_admin.public.query_stats;
  57. truncate table ob_admin.public.client_query_stats;
  58. truncate table ob_admin.public.insert_stats;
  59. truncate table ob_admin.public.error_count;