SELECT * FROM table where yz= ' 1 ' ORDER BY btcount Desc This writes output is incorrect,
Btcount This field is very short, generally =0 or = 1, maximum no more than =8
When the amount of data is large, you cannot press the Btcount value of
Note: Use BTREE to comindex ASC/DESC of each field to optimize order by query efficiency. btreeascThe tbl_direct_pos_201506 table has 1.9 million data, DDL:
Create table 'tbl _ direct_pos_201506 '('acq _ ins_code' char (13) not null default
Using Reverse indexes to Improve the Performance of order by desc using reverse indexes (index desc) can greatly improve the performance of SQL statements with order by desc clauses. I. Scenario 1. Table Name: test_t, with a field name: object_id2,
ORDER BY descending desc, ascending ASC by age descending
Select *from Student ORDER BY age DESCAscending by age
Select *from Student ORDER BY age ASCRank function rank () in descending order of use age, if the sort field is the same, rank
Over cannot be used alone, with analytic functions: Rank (), Dense_rank (), Row_number (), and so on.Its parameters: Over (partition by columnname1 ORDER by Columnname2)Meaning: Group by the field specified by Columname1, or by the value of field
Using the reverse index (index DESC), you can significantly increase the performance of SQL statements with an ORDER BY DESC clause.
Another way is to create a reverse index, such as:CREATE INDEX T_IDX on table_name (time DESC);This creation, the
using the reverse index (index DESC), you can significantly increase the performance of SQL statements with an ORDER BY DESC clause.
first, the scene
1, table name: test_t, there is a field named object_id
2, total data quantity: 580000 line,
The workaround is to add a sorted field to the order by ID Desc, which can improve the speed a lot. The sorted fields vary by query
such as table
Copy Code code as follows:
CREATE TABLE [dbo]. [Cmpp_sendcentre] (
[ID] [int] IDENTITY (1,
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.