mysql查询耗cpu时间,帮小弟我看看如何优化这个mysql结构
mysql查询耗cpu时间,帮我看看怎么优化这个mysql结构
$sqll = "SELECT * FROM `shops` WHERE `subdomain` != '' ORDER BY RAND() LIMIT 15";
只有用到这个查询,对subdomain查询,这个mysql cpu时间很高,新浪的app这个要钱的,不知道怎么优化可以减少mysql cpu时间, 是不是要建个索引啥的? 应该怎么建?还有主键是干嘛的 可以优化吗?
下面是结构

------解决方案--------------------
给 subdomain 字段建个索引试试,不知道能不能用到索引。自己试试看。
------解决方案--------------------
没必要都添加索引,能用到索引的字段添加就可以了。
------解决方案--------------------
subdomain 加索引有用
建主键 会自动生成唯一索引。
------解决方案--------------------
RAND() 不用这个函数 随便程序生成几个随机数

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

According to news from this website on July 28, foreign media TechRader reported that Fujitsu introduced in detail the FUJITSU-MONAKA (hereinafter referred to as MONAKA) processor planned to be shipped in 2027. MONAKACPU is based on the "cloud native 3D many-core" architecture and adopts the Arm instruction set. It is oriented to the data center, edge and telecommunications fields. It is suitable for AI computing and can realize mainframe-level RAS1. Fujitsu said that MONAKA will achieve a leap in energy efficiency and performance: thanks to technologies such as ultra-low voltage (ULV) technology, the CPU can achieve 2 times the energy efficiency of competing products in 2027, and cooling does not require water cooling; in addition, the application performance of the processor It can also reach twice as much as your opponent. In terms of instructions, MONAKA is equipped with vector

IntelArrowLakeisexpectedtobebasedonthesameprocessorarchitectureasLunarLake,meaningthatIntel'sbrandnewLionCoveperformancecoreswillbecombinedwiththeeconomicalSkymontefficiencycores.WhileLunarLakeisonlyavailableasava

According to news from this website on June 1st, the source @CodeCommando tweeted today, sharing some screenshots of AMD’s upcoming presentation documents at the Computex2024 event. The content of the tweet was “AM4 will never die”, and the accompanying picture showed two new Ryzen5000XT series processors. The screenshots show the following two products: Ryzen 95900 Ryzen75800XT It is a faster variant of AMD's existing Ryzen75800X processor. Both processors are clocked up to 4.8G

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

Inteli5-12600 and above CPUs, i5-13400 and above CPUs have P-Core performance cores (large cores) and E-Core energy efficiency cores (small cores). Due to the scheduling problem of "big and small cores", some games may drop frames. , lag, not as good as the old CPU before. In fact, the system thinks that to cope with the current scene, the younger one can handle it, and there is no need to dispatch the older one, so the older core has been resting and not working. The editor below will teach you how to solve this problem. Create a new text document on the desktop, copy the following content, save it as 1.reg, and then right-click to merge. WindowsRegistryEditorVersion5.00[HKEY_LOCAL_MACHINE\SY

According to news from this site on August 22, X platform user 포시포시 (@harukaze5719) noticed that Intel listed two adapter boards suitable for LGA9324-OKS-AP platform power supply testing on its official website DESIGN-iNTOOLSstore. ▲BLU version adapter board, in addition to RED version Intel wrote in the description of these two products that the LGA9324-OKS-APOakStream platform supports DiamondRapids, which positively confirms the next-generation Xeon performance core after Xeon 6 "GraniteRapids" The existence of processors and corresponding platforms. Current information on DiamondRapids processors and OakStream platforms
