当前位置:网站首页>Bi-sql index
Bi-sql index
2022-06-25 01:15:00 【Powerbi white tea】

INDEX
INDEX, Indexes . Index is one of the advanced skills in data warehouse , And a lot of HR What I like to ask in an interview .
Indexes can be used to sort data , And use this to speed up search and sorting .
This and SUBSTITUTEWITHINDEX function It's kind of like . White tea said before when describing this function , This function belongs to one of the higher order functions , The appearance rate is not very high , Only specific scenarios can be used .
This and SQL Medium INDEX It's kind of similar , It is usually used to add index columns to the original dimension columns , To facilitate the calculation of dimensions at certain times , The original text information can be converted into numerical values that can participate in the calculation .
And in the SQL in ,INDEX The performance is more pure .
Basic grammar
CREATE INDEX The index name
ON The name of the table ( Name 1, Name 2...)
-- We can set the index according to a dimension , It can be multiple
matters needing attention
INDEX It can speed up the query , But it will increase the maintenance work .
for example : Attention should be paid to the addition, deletion and modification of INDEX Dynamic update of .INDEX Will increase storage space .
Some data are not suitable for indexing , For example, the provinces of our country , Not much data .
Data that is often used as the basis for sorting , Suitable for indexing .
Interview scene :
Database index is invalid , What are the possible reasons ?
answer :
It may be when the data changes , No maintenance updates to the index .
Using examples
Case data :

In the database of white tea machine , There is a name “TEST” The database of , There is a name “ Product list ” Case data for .
Example 1:
According to the trade name , Add a new column INDEX.
CREATE INDEX Product_INDEX
ON Product list ( Name of commodity )

give the result as follows :


Example 2:
According to the trade name , Add a new column INDEX, Duplicate entries are not allowed in the index .
CREATE UNIQUE INDEX Product_DIS_INDEX
ON Product list ( Name of commodity )

give the result as follows :


Example 3:
According to the trade name , Add a new column INDEX, Duplicate entries are not allowed in the index , And it needs to be in descending order according to the product name .
CREATE UNIQUE INDEX Product_DESC_INDEX
ON Product list ( Name of commodity DESC)

give the result as follows :


Example 4:
According to the commodity name and commodity classification , Add a new column INDEX, Duplicate entries are not allowed in the index .
CREATE UNIQUE INDEX GroupSort
ON Product list ( Name of commodity , Classification of goods )

give the result as follows :




This is white tea , One PowerBI Beginners .

边栏推荐
- 51单片机多机通信
- 15. several methods of thread synchronization
- Scala sample class case calculate
- 启动服务11111
- I 刷题 I — 复制带随机指针的链表
- 用手机在同花顺上开户靠谱吗?这样炒股有没有什么安全隐患
- 粉丝福利,JVM 手册(包含 PDF)
- Danish Technical University pioneered the application of quantum computing to power flow modeling of energy system
- mysql查询时间戳转换成日期格式
- 【直播回顾】2022腾讯云未来社区城市运营方招募会暨SaaS 2.0新品发布会!
猜你喜欢

Assembly language (4) function transfer parameters

利用 Redis 的 sorted set 做每周热评的功能

QT electronic clock

4年工作經驗,多線程間的5種通信方式都說不出來,你敢信?

2022熔化焊接与热切割复训题库模拟考试平台操作

汇编语言(3)16位汇编基础框架与加减循环

Cobalt Strike安装教程

Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source! (high performance + high customization)

1. 封装自己的脚手架 2.创建代码模块

2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination
随机推荐
I 刷题 I — 复制带随机指针的链表
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
Text editor of QT project practice ---------- episode 11
Novice, let me show you the "soft test" at one time
Scala sample object
指南针炒股软件怎么样?安全吗?
The optimism about technology is making Dell achieve more than expected
ContentResolver,拿到手机短信内容
108页(4万字)未来公寓智能化设计平台项目方案建议书2022版
Convert MySQL query timestamp to date format
这个国庆!腾讯云WeCity陪您一同出行,点亮城市地标...
Scala object blending trait
ImageView展示网络图片
Programmer: did you spend all your savings to buy a house in Shenzhen? Or return to Changsha to live a "surplus" life?
中金财富证券开户佣金多少呢?股票开户交易安全靠谱吗?
2022R1快开门式压力容器操作考题及答案
Cobalt strike installation tutorial
Bi-sql select into
15. several methods of thread synchronization
bindservice方法实现音乐播放暂停