(because MySQL can only use an index when querying, so it can only force MySQL to use an index).This will require the use of force index to complete this function.
1. SELECT * from TABLE1 Force INDEX (FIELD1) ...
The above SQL statements use only the indexes built on FIELD1, not the indexes on the other fields. 3. Using temporal tables to provide query performance when the data in the result set of our query is relatively long, we can force the result set to be placed in the temporary table thr
be sorted, or it can be added to a column (like joins or additions). Any non-indexed item in the ORDER BY statement, or a computed expression, will slow down the query. Double-check the order BY statement to find non-indexed items or expressions that degrade performance. The solution to this problem is to rewrite the order BY statement to use the index, or you can establish another index for the column you are using, and you should absolutely avoid using an expression in the ORDER BY clause.(a)
large table horizontally into different sub-tables, so that the columns of each table are the same.A vertical table is a large table that divides different columns into different sub-tables according to different business requirements, associating them with an identical attribute (example ID).A query after a table can be logically judged by the business and then positioned to a child table. For some statistical functions, all child tables are looped and merged.Sub-Library technology : is to use
is the number of records ALIAS2 in the using statement. "The above sentence is also very good explanation of the above statement why only update, but not insert, because all of the select is not the data, how can insert it:)The next step is to change to the correct statement, which is much easier, as follows:MERGE into T T1USING(SELECT ' 1001 ' as a,2 as B fromdual)T2On (t1.a=t2.a)When matched thenUPDATE SET t1.b = t2.bWhen isn't matched thenINSERT (A, B) VALUES (t2.a,t2.b);Query results, ok!At
Main memo: date_format function1: Weibo comparison chart (by daily Statistics)SELECT date_format (tw.article_publish_time, '%y-%m-%d '), Count (page_id) from ' Tab_weibo ' tw where tw.page_id = 1002065079349665 GROUP BY Date_format (Tw.article_publish_time, '%y-%m-%d ') ORDER by Date_format (tw.article_publish_ Time, '%y-%m-%d ') desc;2: Weibo forwarding number of comments (by day)SELECT date_format (tw.article_publish_time, '%y-%m-%d '), sum (tw.arti
character, the field is 4 bytes; The varchar is long, it contains a byte to record the length of the character stored in the field, if the character length is greater than 255 with two bytes to record; therefore, "" empty string, char occupies 4 bytes, VarChar is 1 bytes, "AA" char is 4 bytes, varchar is 3 bytes, "ABCD" char is 4 bytes, varchar is 5 bytes;(7) Text and blog are big characters, so the index can only be built prefix index;Other1. Always remember to judge the legitimacy of incoming
Tags: set nbsp My Computer ends src an automatic log nextBefore the automatic backup process has been completed, the next step is to discuss the issue of creating a completed backup that cannot or cannot be performed automatically.I. When your SQL Server Agent is displayed (disable Agent XP)Right > My Computer > Management >Locate the SQL Server Agent service to start it, and after successful startup, right-click the service > properties to change the service to automatic.Two. The service has be
Tags: size back character echo DEP show default command linesView Buffer command: ListExecute save 1.sql can be saved by the buffer command.Execution @1.sql can execute the saved content;Show feedback Displays the feedback information, the last line.Show Echo onShow ArraySize 5000 View the number of rows for a single line of output, default; 15Set ArraySize 5000 sets the number of lines entered in a single line, default 15;Set heading on |off turn on or off the watch's wardrobe information;Break
Dba_data_filesGroup BY Tablespace_name) bwhere a.tablespace_name = B.tablespace_nameand a.tablespace_name = ' xxx ';-------------------------To view the permissions that the current role XXX has:SELECT * from Dba_sys_privs where grantee= ' XXX ';-------------------------View the table space quotas for user xxx. (-1 is unrestricted)Select Tablespace_name,username,max_bytes from Dba_ts_quotas where username= ' XXX ';-------------------------Set the user MC's tablespace quota limit to 100M:Alter u
UpdateTime by field in the table, numbered every day, numbered from 1, with the table's primary key CID, and storing the data in a temporary tableWith temp as(SELECT Cid,updatetime,Row_number () over (PARTITION by CONVERT (varchar), updatetime, and order by UpdateTime) as Row_numFrom Customer_transfer)Update Batchno from the temporary table according to the primary key CID, giving the numbering settingUPDATE m SET M.batchno = T.row_numFrom customer_transfer m JOIN temp tOn m.cid = T.cidRenumber
Each year, select To_char (createtime, ' YYYY ') year, COUNT (*) from table GROUP by To_char (Createtime, ' YYYY '); Quarterly select To_char (Create Time, ' Q ') of the Year, COUNT (*) from the table group by To_char (Createtime, ' Q '); monthly select To_char (createtime, ' YYYY '), To_char (creat ETime, ' mm ') month, COUNT (*) from table GROUP by To_char (Createtime, ' YYYY '), To_char (createtime, ' mm '); daily select To_char (Crea Tetime, ' YYY
string. For example:Sql> Select InStr (' abcdefgh ', ' de ') position from dual;POSITION----------4Starting from 1, the D row is the four, so return 4.Sql>select InStr (' Abcdefghbc ', ' BC ', 3) position from dual;POSITION----------9The 3rd character starting from the 3rd character is C, so find the BC after the 3 string, return 9---------------------------Starting with the 1th character, find the location of the 2nd occurrence of a substringSql> Select InStr (' Qinyinglianqin ', ' Qin ', 1, 2
duplicate name, and sure enough there are 1 duplicate name 3) "Find name with no return value" Finally, Vimdiff, mysql.log and sort_unique.log(both achieve the same sort) can see exactly what name is in the data table The user did not return the 3. Summary
The first is that my MySQL query statement needs to be improved, and then, when a technology does not solve the problem, you can mix multiple technologies. Like the shell mentioned above in the text processing, sorting, de-weight
The author in the daily optimization is always like in the webmaster network to see some optimization of the article, there are many articles can make the author touched a lot. Recently in the Webmaster network wandering, the author saw a lot of optimization cheats article, on this is also a bit of feeling, the author has always felt that optimization is a step-by-step procedure, during which we need to constantly analyze and adjust the need for conti
1, what is Gerrit.
Gerrit is actually a git server that provides a series of permissions control for a git repository hosted on its server, and a web front page for code review. Of course, its main function is to do code Review. 2, Gerrit User Configuration Email activation Gerrit Account Settings interface, click "Contact Information" to enter the email register page, enter your own mailbox account ( This mailbox needs to be consistent with their own git configuration ). Multiple email accoun
Tags: where lock order var nvarchar char SQL Server Art Sele SELECTDttime,SUM(A.price)'Sales',Count(1)'Number of orders'
from(SELECT Case
when DATEPART(MI, o.create_at) -
Then
CONVERT(DATETIME,CONVERT(NVARCHAR( -), Create_at, at)+' '+CONVERT(VARCHAR( -),DATEPART(hh, Create_at))+': 00:00')
ELSE
CONVERT(DATETIME,CONVERT(NVARCHAR( -), Create_at, at)+' '+CONVERT(VARCHAR( -),DATEPART(hh, Create_at))+': 30:00'
not block any applications and ensures consistent state of the database at the time of export.--include-master-host-port add ' master_host=To export a table structure:Mysqldump-e-r-b db_xx--no-data--skip-add-drop-table-u user_xx-p pwd_xx >xxx.sqlFrom the data on the guide:Mysqldump-e-r-b db_xx--dump-slave--single-transaction--skip-add-drop-table-u user_xx-p pwd_xx >xxx.sqlOur guide data:Mysqldump-e-r-b db_xx--master-data--single-transaction--skip-add-drop-table-u user_xx-p pwd_xx >xxx.sqlMYSQLD
Because of firewall problem, TCP keep alive problem, and MySQL own parameter problem these three are more common in use, so share the troubleshooting method that you found today.Let's talk about a firewall today.Most people start trying to connect after the first time the MySQL database on Azure instance is created. However, the result that is often encountered is not a successful connection but the error message as shown:This error message indicates that your IP address is not within the access
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service