Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/release-sql-analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: release sql-analyzer
on:
push:
tags:
- 'sql-analyzer-[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
- "sql-analyzer-[0-9]+.[0-9]+.[0-9]+"

env:
tagName: ${{ github.ref_name }}
Expand Down Expand Up @@ -47,17 +46,17 @@ jobs:
run: |
echo "version=$(echo $tagName | grep -P '(\d*\.\d*\.\d*)' --only-matching)" >> $GITHUB_OUTPUT

- name: Create and push manifests w/o cache
- name: Build and push sql-analyzer w/o cache
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
file: build/Dockerfile.sql-analyzer
file: ./build/Dockerfile.sql-analyzer
push: true
tags: |
${{ vars.DOCKER_PUSH_BASE }}/sql-analyzer:${{ steps.set_version_vars.outputs.version }}
${{ vars.DOCKER_PUSH_BASE }}/sql-analyzer:latest
quay.io/${{ vars.QUAY_IO_PUSH_BASE }}/sql-analyzer:${{ steps.set_version_vars.outputs.version }}
quay.io/${{ vars.QUAY_IO_PUSH_BASE }}/sql-analyzer:latest
ghcr.io/${{ github.repository_owner }}/sql-analyzer:${{ steps.set_version_vars.outputs.version }}
${{ vars.DOCKER_PUSH_BASE }}/sql-analyzer:latest
quay.io/${{ vars.QUAY_IO_PUSH_BASE }}/sql-analyzer:latest
ghcr.io/${{ github.repository_owner }}/sql-analyzer:latest
4 changes: 2 additions & 2 deletions charts/oceanbase-dashboard/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.5.0
version: 0.6.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.5.0"
appVersion: "0.6.0"
60 changes: 19 additions & 41 deletions internal/sql-analyzer/const/sql/sql_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,56 +83,34 @@ const (
CheckPlanExistence = `SELECT COUNT(*) FROM sql_plan WHERE TENANT_ID = ? AND SVR_IP = ? AND SVR_PORT = ? AND PLAN_ID = ?`
GetPlanStats = `
WITH PlanAgg AS (
SELECT
TENANT_ID,
SVR_IP,
SVR_PORT,
PLAN_ID,
PLAN_HASH,
MAX(GMT_CREATE) as GMT_CREATE,
SUM(IO_COST) as IO_COST,
SUM(CPU_COST) as CPU_COST,
SUM(COST) as COST,
SUM(REAL_COST) as REAL_COST
FROM sql_plan
WHERE SQL_ID = ?
GROUP BY TENANT_ID, SVR_IP, SVR_PORT, PLAN_ID, PLAN_HASH
),
PlanStats AS (
SELECT
PLAN_HASH,
CAST(AVG(IO_COST) AS BIGINT) as IO_COST,
CAST(AVG(CPU_COST) AS BIGINT) as CPU_COST,
CAST(AVG(COST) AS BIGINT) as COST,
CAST(AVG(REAL_COST) AS BIGINT) as REAL_COST
FROM PlanAgg
GROUP BY PLAN_HASH
),
LatestPlan AS (
SELECT
TENANT_ID,
SVR_IP,
SVR_PORT,
PLAN_ID,
PLAN_HASH,
GMT_CREATE,
ROW_NUMBER() OVER (PARTITION BY PLAN_HASH ORDER BY GMT_CREATE DESC, PLAN_ID DESC) as rn
FROM PlanAgg
IO_COST,
CPU_COST,
COST,
REAL_COST,
ROW_NUMBER() OVER (PARTITION BY TENANT_ID, SVR_IP, SVR_PORT, PLAN_HASH ORDER BY GMT_CREATE DESC, PLAN_ID DESC) as rn
FROM sql_plan
WHERE SQL_ID = ? AND ID = 0
)
SELECT
lp.TENANT_ID,
lp.SVR_IP,
lp.SVR_PORT,
lp.PLAN_ID,
lp.PLAN_HASH,
lp.GMT_CREATE,
ps.IO_COST,
ps.CPU_COST,
ps.COST,
ps.REAL_COST
FROM LatestPlan lp
JOIN PlanStats ps ON lp.PLAN_HASH = ps.PLAN_HASH
WHERE lp.rn = 1
TENANT_ID,
SVR_IP,
SVR_PORT,
PLAN_ID,
PLAN_HASH,
GMT_CREATE,
IO_COST,
CPU_COST,
COST,
REAL_COST
FROM PlanAgg
WHERE rn = 1
`
GetTableInfo = `
SELECT
Expand Down
3 changes: 2 additions & 1 deletion internal/sql-analyzer/generated/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ const docTemplate = `{
"type": "integer"
},
"planHash": {
"type": "integer"
"type": "string",
"example": "0"
},
"planId": {
"type": "integer"
Expand Down
3 changes: 2 additions & 1 deletion internal/sql-analyzer/generated/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@
"type": "integer"
},
"planHash": {
"type": "integer"
"type": "string",
"example": "0"
},
"planId": {
"type": "integer"
Expand Down
3 changes: 2 additions & 1 deletion internal/sql-analyzer/generated/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ definitions:
ioCost:
type: integer
planHash:
type: integer
example: "0"
type: string
planId:
type: integer
realCost:
Expand Down
2 changes: 1 addition & 1 deletion make/dashboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROJECT=oceanbase-dashboard

PWD ?= $(shell pwd)

DASHBOARD_VERSION ?= 0.5.0
DASHBOARD_VERSION ?= 0.6.0
DASHBOARD_IMG ?= quay.io/oceanbase/oceanbase-dashboard:${DASHBOARD_VERSION}
COMMIT_HASH ?= $(shell git rev-parse --short HEAD)
BUILD_TIMESTAMP ?= $(shell date '+%Y%m%d%H%M%S')
Expand Down
Loading