Explain analyze dropdown button (#532)

* Adds bootstrap dropdown plugin
* Float dropdown toggle left
* Extract query running message toggles
* Adds analyze function and api call
* Adds analyze api
This commit is contained in:
Tim Ings
2022-01-04 09:05:46 +08:00
committed by GitHub
parent af79994595
commit 17e95601ec
6 changed files with 223 additions and 15 deletions

View File

@@ -280,7 +280,7 @@ func RunQuery(c *gin.Context) {
HandleQuery(query, c)
}
// ExplainQuery renders query analyze profile
// ExplainQuery renders query explain plan
func ExplainQuery(c *gin.Context) {
query := cleanQuery(c.Request.FormValue("query"))
@@ -289,6 +289,18 @@ func ExplainQuery(c *gin.Context) {
return
}
HandleQuery(fmt.Sprintf("EXPLAIN %s", query), c)
}
// AnalyzeQuery renders query explain plan and analyze profile
func AnalyzeQuery(c *gin.Context) {
query := cleanQuery(c.Request.FormValue("query"))
if query == "" {
badRequest(c, errQueryRequired)
return
}
HandleQuery(fmt.Sprintf("EXPLAIN ANALYZE %s", query), c)
}

View File

@@ -50,6 +50,8 @@ func SetupRoutes(router *gin.Engine) {
api.POST("/query", RunQuery)
api.GET("/explain", ExplainQuery)
api.POST("/explain", ExplainQuery)
api.GET("/analyze", AnalyzeQuery)
api.POST("/analyze", AnalyzeQuery)
api.GET("/history", GetHistory)
api.GET("/bookmarks", GetBookmarks)
api.GET("/export", DataExport)