|
1 | 1 | # PawSQL Client |
2 | | - |
3 | 2 | [English](README.md) | [中文](README_zh-CN.md) |
4 | 3 |
|
5 | 4 | ## Introduction |
| 5 | +PawSQL Client enables developers to access core capabilities of the PawSQL directly within their VS Code development environment. PawSQL provides sosophisticated SQL optimization features including smart index recommendations and query rewriting suggestions.. PawSQL Client requires integration with the PawSQL optimization platform (either [PawSQL Cloud](https://pawsql.com) or enterprise private deployment). For comprehensive SQL optimization capabilities, please refer to the [PawSQL Technical Documentation](https://docs.pawsql.com). |
6 | 6 |
|
7 | | -PawSQL Client is a plugin for Visual Studio Code that helps developers optimize SQL queries and manage workspaces. Through integration with the PawSQL API, users can easily perform SQL optimization and view optimization results. |
| 7 | +[Watch PawSQL Client Demo](https://www.bilibili.com/video/BV19aDBYAEcr/) |
8 | 8 |
|
9 | 9 | ## Features |
10 | | - |
11 | | -- **SQL optimization**: Select SQL queries and optimize using the PawSQL API. |
12 | | - |
13 | | -- **Workspace management**: Connect to a PawSQL workspace for easy switching and management. |
14 | | - |
15 | | -- **Error handling**: Provides detailed error information and friendly prompts. |
| 10 | +- **SQL Optimization**: Get optimization recommendation by one click. |
| 11 | +- **Intelligent index recommendation**: Recommend optimal indexes based on input SQL syntax, database objects and statistics information |
| 12 | +- **Rewrite Optimization**: Recommend semantically equivalent, but more efficient SQLs |
| 13 | +- **Performance Validation**: Ensure better performance after SQL rewrite and index recommendation |
16 | 14 |
|
17 | 15 | ## Installation |
18 | | - |
19 | | -1. Open Visual Studio Code. |
20 | | - |
21 | | -2. Go to the Extensions view (`Ctrl+Shift+X` or `Cmd+Shift+X`). |
22 | | - |
23 | | -3. Search for "PawSQL" and click Install. |
24 | | - |
25 | | -## Instructions |
26 | | - |
27 | | -### Configure API key |
28 | | - |
29 | | -Before using the plugin, you need to configure the PawSQL API key: |
30 | | - |
31 | | -1. Open Settings (`Ctrl+,` or `Cmd+,`). |
32 | | -2. Search for "PawSQL". |
33 | | -3. Enter your API key and save. |
34 | | - |
35 | | -### Optimize SQL Queries |
36 | | - |
37 | | -1. Select the SQL query to be optimized in the editor. |
38 | | -2. Right-click and select "Optimize SQL" or use the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) to enter "Optimize SQL". |
39 | | -3. Click Select Workspace to get it, and click Execute Optimization. |
40 | | -3. Wait for the optimization results and view the report according to the prompts. |
41 | | - |
42 | | -### Manage Workspaces |
43 | | - |
44 | | -1. Use the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) to enter "Select Workspace". |
45 | | -2. Select a workspace from the list to connect. |
46 | | - |
47 | | -## Error Handling |
48 | | - |
49 | | -During use, if you encounter any problems, the plugin will display detailed error information and solution tips. For example: |
50 | | - |
51 | | -- API key not configured: Please add API key in settings. |
52 | | -- Invalid SQL query: Please select valid SQL text to optimize. |
| 16 | +1. Open Visual Studio Code |
| 17 | +2. Navigate to Extensions view (`Ctrl+Shift+X` or `Cmd+Shift+X`) |
| 18 | +3. Search for "PawSQL Client" and click Install |
| 19 | + |
| 20 | +## Initial Setup |
| 21 | +When using the extension for the first time, complete these configuration steps: |
| 22 | +1. Click the PawSQL icon in the VSCode sidebar to access configuration |
| 23 | +2. Fill in the following configuration fields: |
| 24 | + - Backend URL (e.g., `https://pawsql.com`) |
| 25 | + - Frontend URL (e.g., `https://pawsql.com`) |
| 26 | + - API Key (Your PawSQL API key, available in the platform's user settings) |
| 27 | +3. Click "Save" |
| 28 | + |
| 29 | +Upon successful configuration, the sidebar will load your workspace list (last 100 workspaces at most). |
| 30 | + |
| 31 | +## Usage Guide |
| 32 | +### SQL Optimization in VS Code |
| 33 | +Two optimization methods are available in SQL files: |
| 34 | +1. **Optimize Using Default Workspace**: |
| 35 | + - Click the "Optimize" button in the SQL statement prompt |
| 36 | +2. **Optimize Using Specific Workspace**: |
| 37 | + - Click the "Optimize..." button in the SQL statement prompt |
| 38 | + - Select a workspace from the dropdown menu |
| 39 | + |
| 40 | +### Optimization Results |
| 41 | +After optimization completion: |
| 42 | +- Results are displayed in VSCode's WebView |
| 43 | +- Click "View Detailed Optimization in Browser" for additional information, including: |
| 44 | + - SQL comparison |
| 45 | + - Execution plan comparison |
| 46 | + - Detailed analysis |
| 47 | + |
| 48 | +Recent optimization results (last 10 per workspace) automatically appear in the sidebar under their respective workspaces. |
| 49 | + |
| 50 | +## Important Notes |
| 51 | +- Ensure PawSQL Backend URL and Frontend URL are accessible |
| 52 | +- API Key is your unique identifier for [PawSQL Cloud](https://pawsql.com) or private deployment platform, available in the platform's user settings |
0 commit comments