Add context menu to display database tables stats (#639)

* Add context menu to display database tables stats

* Move table stats implementation into client
This commit is contained in:
Dan Sosedoff
2023-01-23 14:10:26 -06:00
committed by GitHub
parent 06212b4c34
commit 5b2d4e4454
8 changed files with 94 additions and 0 deletions

View File

@@ -497,6 +497,12 @@ func GetTableConstraints(c *gin.Context) {
serveResult(c, res, err)
}
// GetTablesStats renders data sizes and estimated rows for all tables in the database
func GetTablesStats(c *gin.Context) {
res, err := DB(c).TablesStats()
serveResult(c, res, err)
}
// HandleQuery runs the database query
func HandleQuery(query string, c *gin.Context) {
metrics.IncrementQueriesCount()

View File

@@ -43,6 +43,7 @@ func SetupRoutes(router *gin.Engine) {
api.GET("/tables/:table/info", GetTableInfo)
api.GET("/tables/:table/indexes", GetTableIndexes)
api.GET("/tables/:table/constraints", GetTableConstraints)
api.GET("/tables_stats", GetTablesStats)
api.GET("/functions/:id", GetFunction)
api.GET("/query", RunQuery)
api.POST("/query", RunQuery)