GBASE Rescue Record: Three-Step Breakthrough to Achieve 55s → 0.8s Performance Leap

Published on 2025-04-03

Performance Challenges During System Migration

4 AM, at a bank's system upgrade site—

 After five grueling hours, the 242 GB core transaction table was finally migrated.

💻 Breathing a sigh of relief, engineer Xiao Zheng entered a simple SQL to check the system performance after migration: 

He took a sip of tea, carefully wiped his fogged-up glasses, and looked up—the SQL response time on the screen made his eyes widen in shock.

A painful 55-second response. This was definitely not normal.

"Is this the Chinese database solution we bet everything on?" Xiao Zheng stared at the glaring number, his clenched fist trembling slightly. But his tech professional's stubbornness made him grab the phone: "Xiao An, we need an emergency database rescue!"

GBASE Technical Expert's Three-Step Breakthrough

Step One: Deep CT Scan of the Execution Plan

GBase technical expert Xiao An immediately went onsite to investigate. He carefully studied the table—a financial-grade "beast" of a sharded table with over 200 million records, about 240 GB. On the MySQL side, the sharding strategy was by month; after migrating to GBase 8s, it was changed to automatic sharding by year.

When in doubt, check the execution plan. After understanding the table's basics, Xiao An examined the SQL execution plan:

From the execution plan, it was clear the query used an index on the ricd column, but the SQL filter conditions were part_dt and ricd. The single-leg index caused a full scan of all shards. Additionally, outdated statistics led to optimizer misestimation.

Step Two: Launching the Dual Engines: Composite Index + Statistics Refresh

Xiao An set up a simulation environment with 5 million records, querying only the group that returned 9,999 rows.

1. Precision Index Surgery: Create a composite index (part_dt, ricd)

2. High-Priority Index Operation: Update statistics via update statistics

Simulated environment test: A sandbox drill on 5 million records → 9,999 results returned in a lightning-fast 0.008 seconds!

Step Three: Stress Test in the Production Furnace

Xiao An implemented the solution in the real production environment. The results showed that even with more complex data, the optimization was remarkably effective: SQL response time dropped from 55 seconds to 0.8 seconds. Even with larger data volume per shard than MySQL, query efficiency was on par with MySQL.

Seeing the instant results, Xiao Zheng was thrilled, and he expressed deep appreciation to Xiao An: "This Chinese database is not just 'usable'—it's truly excellent! With optimized indexing strategies and regular maintenance, the GBase database is fully capable of handling massive financial-grade data loads!"

GBASE Insight

1. For partitioned tables, adding a composite index on the partition key and primary key, along with high-priority statistics updates, can significantly improve performance. In practice, you can schedule this high-priority task as a cron job, e.g., once per week.

2. For indexes on auto-sharded tables, where shards may number in the thousands, it is recommended to use an IN clause for a global index.

3. Unlike regular tables, for sharded tables, consider creating indexes before importing data. For sharded table conversions that involve appending historical data while running in production, creating indexes first is essential.