微信公众平台

MySQL慢查询定位三板斧:慢日志+EXPLAIN+索引_我的网站

白鹿原

A |     

Yin Yunzhen introduces to Sakolsky the harvest from the once-barren wasteland. Photo: Lin Xiaoyi/GT
    Yin Yunzhen introduces to Sakolsky the harvest from the once-barren wasteland. Photo: Lin Xiaoyi/GT
On Monday afternoon, American teacher Ronald Sakolsky visited the homeland of Chinese desert fighter Yin Yuzhen in Uxin Banner of Ordos, Inner Mongolia Autonomous Region. This was a place the American man had visited in 2000 and it has completely changed since then.
In 1999, Sakolsky, a teacher in a China-US education exchange program, was touched by a report on Yin and her husband's afforestation efforts in the harsh wilderness of Mu Us Desert, and raised $5,000 to support her green cause. During that visit, they took pictures - in front of the sunken pit where the Yin couple once resided and in the barren land with a finger-thin sapling they had just planted against a backdrop of dust and bare earth.
What has the $5,000 changed? 
On Monday, they came to the Sakolsky forest - a permanent tribute honoring Sakolsky's early contribution to the region's ecological revival - and replicated the vintage pictures, standing in front of a pit that has long been abandoned and beside a newly planted sapling. This time, however, there are bushes and trees in the background. 
This contrast not only witnessed their friendship across time and the Pacific Ocean, but also showcased a promise Yin has kept for 27 years and a green dream that has been made possible through generations of joint unwavering efforts from Yin, her husband and countless other sand fighters. 
Homecoming with family cooking 

Yin hosted Sakolsky on Monday at her home,  filling the air with the aroma of home-cooked meals during their long-awaited reunion. Watermelons were served along with other fresh fruits and vegetables, all harvested locally. Yin told the Global Times earlier that she learned the English word "more" to persuade him to eat more.  
In 1999, Yin had few options for showing her hospitality, so she cooked a bowl of plain noodles for Sakolsky. Now, the harsh wasteland has transformed into a vibrant green oasis, thanks to unwavering afforestation efforts.
In the courtyard, the Global Times reporter saw Yin grinning from ear to ear with pride as she introduced the produce from the farmland - green pepper longer than a palm, a bottle gourd even bigger than Yin's head, and bags of foxtail millet packaged with the assistance of Yin's grandchildren, who are proud of the family's generations of commitment to green causes.    
During a tour of Yin's home, Sakolsky was impressed by the beautiful house with its green courtyard, saying "You deserve every centimeter of this house." Throughout the visit, he repeatedly praised Yin's hands, which the desert fighter and model worker used to change both the land and her own life through arduous work. 
The $5,000 Sakolsky donated in 1999 was equivalent to three years' income for Yin's entire family at the time. Today, that money has grown into more than 50,000 trees.
But Yin's journey did not stop there. Over the following decades, with the support of China's growing ecological restoration policies — including subsidies for afforestation and compensation for forest managers — she transformed the barren land into a productive family forest farm. Her success has inspired many others in the region to take up tree planting and sand control, transforming what was once a desperate struggle into a sustainable livelihood.
From the sandy hollow where the Yin couple lived in in 1985 and the earth hut they resided in until 1993, to the solid brick house Sakolsky saw when he last visited, and the two-story house the big family now lives in, the change in living environment is a clear example of ecological dividends.  
Uxin Banner lies in the heartland of the Mu Us Desert. The desertification rate was over 90 percent in the 1950s and forestation coverage was merely 7.2 percent as of 1980. Now, the forestation rate has increased to 33 percent, while plantation coverage has expanded to 85 percent, per official data. 
Sakolsky and Yin enjoy watermelons and other fruits at Yin's home. Photo: Lin Xiaoyi/GT
    Sakolsky and Yin enjoy watermelons and other fruits at Yin's home. Photo: Lin Xiaoyi/GT
Carry on the greenness, kindness 
This miracle would have been impossible without numerous people like Yin, long-term systematic planning and scientific governance. 
Chen Ziliang, an expert from the local forestry and grassland bureau, said that Mu Us Desert's sand‑control journey has evolved from collective afforestation to contract desert‑reclamation, moving beyond the simple goal of "keeping trees alive" to restoring vegetation based on water‑resource conditions.  
Putting the idea of "lucid waters and lush mountains are invaluable assets" into practice, Uxin Banner no longer views "greenness" and "growth" as an either‑or proposition. On restored sandy lands, the under‑forest economy, eco‑agriculture and eco‑tourism have flourished. Sand‑fixing shrubs are now processed into animal feed and biomass fuel, and local authorities are exploring photovoltaic‑powered desert control, the Global Times learned. 
Sand control is no longer just about keeping sand away; it's a development approach that guarantees a greener and better living environment alongside a booming economy and increasing incomes. 
On Monday afternoon, when Sakolsky finally stepped into the forest named after him, this American teacher witnessed the Chinese woman's perseverance and commitment to her promises. The $5,000 donated without expectations has grown into a thriving forest of around 50,000 trees. 
"A promise is a promise. Ms. Yin fulfilled her promise," Sakolsky said. After 27 years, the wasteland is green, and Sakolsky and Yin are "brother and sister." 
"This is the answer to how we guide young people: We must teach them love and perseverance. We need to show young people photos of Ms. Yin planting trees, digging the soil with her bare hands," Sakolsky remarked while packing a jar of sand. He said he planned to bring it back to the US, telling his grandchildren it is not just a jar of sand, but "a jar of love."   
Sakolsky told the Global Times earlier that the younger generation only knows about the dust-covered landscape from photos and stories of the elderly. It is important to tell them how the greenness is achieved, and how every single person can contribute to making an extensive forest in the harshest environment. 
"I see where China and America can work together. I see it, so I will not quit. She [Yin] never quit. 'Quit' is not in her vocabulary," Sakolsky said with emotion on Monday. 
"Chinese and Americans can be family. We can get over the differences if we focus on the similarities... If we focus on our similarities and not our differences, we can solve the problems."
At the end of Monday's schedule, Yin and Sakolsky planted another sapling together, just as they did about three decades ago, but in a completely different landscape. 
This new sapling carries on the story of not only greenness through generations of joint efforts, but also kindness across the Pacific Ocean. 
。    

     一键部署OpenClaw        

网站卡顿不一定是代码慢,很可能是数据库在硬扛。MySQL慢查询日志是最直接的突破口,先把执行时间长的SQL抓出来,再一条条用EXPLAIN看执行计划,最后加索引或者改写法。    

     开启慢日志很简单,在my.cnf里加三行,重启MySQL即可。注意long_query_time单位是秒,线上可以先设1秒,抓到明显拖后腿的语句。    [mysqld]    slow_query_log = 1    slow_query_log_file = /var/log/mysql/slow.log    long_query_time = 1    log_queries_not_using_indexes = 1    

抓到慢SQL后,用EXPLAIN看type列。如果出现ALL,说明是全表扫描,必须优化。理想情况至少达到range,最好到ref或eq_ref。

B |     EXPLAIN SELECT * FROM orders WHERE user_id = 123 AND create_time > '2026-08-01';         -- 给常用查询列加复合索引    CREATE INDEX idx_user_time ON orders(user_id, create_time);    

索引不是越多越好。写操作会因为索引而变慢,而且索引文件本身也占空间。原则是高频查询、WHERE条件里的等值列优先建,范围查询列放在复合索引后面。

        
    

申请创业报道,分享创业好点子。点击此处,共同探讨创业新机遇!。

Current article:http://30imu.zhouangnaoguangsundianzhenmou.cfd/hln24/20260826/53423.html

Published on:19:23:55


相关新闻

不结婚

00:51:27

侦探物语

13:21:05

热门推荐

  • 或命名方程豹钛7 方程豹品牌发布旗下全新车型预告图
  • 本周你可能错过的13个电影、游戏及电视预告片
  • 35年老IP深陷抄袭争议!押注八年,《梦战:剑之海》还有活路吗?
  • “飞人”博尔特40岁求婚成功 已与女友有4个孩子
  • 【观点】南华期货:硅铁成本支撑高位震荡,硅锰高库存压制上行
  • Takaichi reportedly mulls skipping visit to notorious Yasukuni Shrine on anniversary of WWII surrender; experts see political maneuvering, not historical remorse
  • 创业板指跌逾2%
  • 哈尔滨倾斜居民楼已开始拆除 倾斜居民楼曾被公示存在极大安全隐患
  • 行走的20万?博主直播激活苹果iPhone 14 Pro Max被封禁_微信_网友
  • 中国女足抵美海外拉练 备战亚运会和女足世界杯
  • 微信公众平台版权所有 本站点信息未经允许不得复制或镜像 法律顾问:冲上云霄2 女生名叫黄蒲军校
  • 微信公众平台 copyright ? 2000 - 2019
  • 真女神转生 半泽直树 无间道二 银魂 真人版