In real-world systems, working with a database is not just about querying dataβitβs about:
- Updating records correctly
- Cleaning up unnecessary data
- Debugging performance issues when things go wrong
GBase database provides both:
β
Standard SQL operations (UPDATE, DELETE, TRUNCATE)
β
Powerful internal diagnostic tools (onstat)
This article combines both perspectives into a complete developer + DBA workflow.
βοΈ Part 1: Core Data Operations in GBase
π UPDATE β Modify Existing Data
The UPDATE statement allows you to change existing records.
UPDATE users
SET age = 25
WHERE id = 1;
π GBase follows standard SQL syntax for updates ([GBase][1])
ποΈ DELETE β Remove Specific Rows
DELETE FROM users
WHERE id = 1;
- Removes selected rows
- Keeps table structure intact
β‘ TRUNCATE β Fast Full Cleanup
TRUNCATE TABLE users;
- Removes all rows instantly
- Much faster than DELETE
- Minimal logging
GBase also supports recovery via recycle bin / flashback, depending on configuration ([GBase][2])
β οΈ Important Limitation (Real-World Case)
When using advanced features like DBLink:
UPDATE table@dblink SET col = 1;
β Not supported in GBase
Some distributed scenarios do not allow UPDATE/DELETE operations, which must be handled locally ([GBase][3])
π§ Part 2: What Happens When Things Go Wrong?
After executing data operations, you may encounter:
- Slow queries
- Locked rows
- High CPU usage
- Hanging sessions
This is where GBase internal tools become critical.
π Part 3: Debugging with onstat
π Check System Status
onstat -
Shows database runtime status:
- Online/offline
- Uptime
- Memory usage
ποΈ Inspect Storage Usage
onstat -d
Displays:
- Dbspaces
- Chunk files
- Storage allocation
Helps identify disk pressure or imbalance ([GBase][4])
π Analyze Locks
onstat -k
Shows:
- Active locks
- Waiting sessions
- Lock types
Useful when:
π DELETE or UPDATE gets stuck
π₯ Monitor Active Sessions
onstat -g ses
Displays:
- Connected users
- Memory usage
- Running queries
You can identify problematic sessions and even terminate them:
onmode -z <session_id>
β οΈ Killing sessions may interrupt transactions ([GBase][4])
π Check Performance Metrics
onstat -p
Shows:
- Disk reads/writes
- Buffer usage
- Query activity
This helps diagnose:
- Slow DELETE operations
- Heavy UPDATE workloads
π Full Workflow: Modify + Diagnose
Hereβs how developers and DBAs typically work in GBase:
Step 1: Modify Data
UPDATE orders SET status = 'processed' WHERE id = 100;
Step 2: Issue Detected (Slow / Locked)
Step 3: Check Sessions
onstat -g ses
Step 4: Check Locks
onstat -k
Step 5: Inspect System Load
onstat -p
Step 6: Take Action
- Optimize SQL
- Add indexes
- Kill problematic sessions
β‘ Best Practices
β Always Use WHERE Clause
UPDATE users SET age = 30;
β This updates all rows
β Use TRUNCATE for Large Tables
Better for:
- Logs
- Temporary data
- Batch cleanup
β Monitor After Heavy Operations
After large DELETE/UPDATE:
onstat -p
Check system impact.
β Watch for Locks
Long-running transactions can block others:
onstat -k
π§ Key Insight
GBase is powerful because it combines:
- Standard SQL operations β easy data manipulation
- Low-level diagnostic tools β deep system visibility
Many databases only give you SQLβ
GBase gives you internal observability.
π Final Thoughts
To use GBase effectively, you need both skills:
π§βπ» Developer mindset
- Write correct UPDATE / DELETE logic
π οΈ DBA mindset
- Diagnose performance with
onstat
Top comments (0)