pub struct PgStatsRepository { /* private fields */ }Implementations§
Source§impl PgStatsRepository
impl PgStatsRepository
pub fn new(pool: PgPool) -> Self
Sourcepub async fn schema_overview(&self) -> Result<RelationalSchema, DomainError>
pub async fn schema_overview(&self) -> Result<RelationalSchema, DomainError>
Every table in the user schema with its columns, for the lab’s schema
browser and SQL-editor click-to-insert sidebar. _sqlx_migrations is
sqlx’s own bookkeeping table and is filtered out.
pub async fn database_size(&self) -> Result<DatabaseSize, DomainError>
pub async fn table_stats( &self, limit: i64, offset: i64, ) -> Result<Vec<TableStats>, DomainError>
pub async fn index_stats( &self, limit: i64, ) -> Result<Vec<IndexStats>, DomainError>
pub async fn activity(&self, limit: i64) -> Result<Vec<Activity>, DomainError>
pub async fn blocking_locks(&self) -> Result<Vec<BlockingLock>, DomainError>
Sourcepub async fn has_pg_stat_statements(&self) -> Result<bool, DomainError>
pub async fn has_pg_stat_statements(&self) -> Result<bool, DomainError>
Returns true when the pg_stat_statements extension is installed.
Cheap (a single index lookup against pg_extension); callers should
check this before calling Self::slow_queries.
Sourcepub async fn table_schema(
&self,
name: &str,
) -> Result<Option<TableSchema>, DomainError>
pub async fn table_schema( &self, name: &str, ) -> Result<Option<TableSchema>, DomainError>
Full schema introspection for a single relation. Returns None
when the table doesn’t exist (or isn’t a relation/matview/
partitioned table). Each query is one indexed catalog lookup,
fine for an on-demand drill-down view.
pub async fn slow_queries( &self, limit: i64, ) -> Result<Vec<SlowQuery>, DomainError>
Trait Implementations§
Source§impl Clone for PgStatsRepository
impl Clone for PgStatsRepository
Source§impl DbStats for PgStatsRepository
The introspection capability, delegating to the inherent query methods.
Explicit PgStatsRepository::method(self, ...) paths avoid resolving back
to the trait method and recursing.
impl DbStats for PgStatsRepository
The introspection capability, delegating to the inherent query methods.
Explicit PgStatsRepository::method(self, ...) paths avoid resolving back
to the trait method and recursing.
Source§fn schema_overview<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RelationalSchema, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn schema_overview<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RelationalSchema, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn database_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DatabaseSize, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn table_stats<'life0, 'async_trait>(
&'life0 self,
limit: i64,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<TableStats>, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn index_stats<'life0, 'async_trait>(
&'life0 self,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexStats>, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn activity<'life0, 'async_trait>(
&'life0 self,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Activity>, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn blocking_locks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<BlockingLock>, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn table_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<TableSchema>, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn has_slow_query_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has_slow_query_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Self::slow_queries) is
available on this engine right now.fn slow_queries<'life0, 'async_trait>(
&'life0 self,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<SlowQuery>, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn optimize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn optimize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
VACUUM/ANALYZE, Postgres ANALYZE). The default is a
no-op so a backend without a meaningful action need not implement it;
the lab UI gates the button on the backend reporting one.Auto Trait Implementations§
impl !RefUnwindSafe for PgStatsRepository
impl !UnwindSafe for PgStatsRepository
impl Freeze for PgStatsRepository
impl Send for PgStatsRepository
impl Sync for PgStatsRepository
impl Unpin for PgStatsRepository
impl UnsafeUnpin for PgStatsRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more