Search
Register
Login

 Indexes: Dense versus Sparse, Primary and Secondary Indexes, Indexes using Composite Search Keys

 

Welcome to class! 

In today’s class, we will be talking about indexes: dense versus sparse, primary and secondary indexes, indexes using composite search keys. Enjoy the class!

Dense Versus Sparse Index

 Indexes: Dense versus Sparse, Primary and Secondary Indexes, Indexes using Composite Search Keys | classnotes.ng

Dense index

This is said to be dense if it contains (at least) one data entry for every search key value that appears in a record in the indexed file.

In a dense index, index record appears for every search key value in the file or table. That is every search key in the index column has a particular record it will point to in the table or file.

For example:

dense index classnotes.ng

From the figure above, we can see that each search key in the index has a particular record that it points to in the base table

Sparse index

In a sparse index, each search key does not have a corresponding record it points to but may point to a group of records in the base table. For example:

SPARSE INDEX

 From the figure above, search keys such as 12121, 15151 do not have corresponding records in the index but you can search for them through 10101 key to retrieve their records in the base table.

A Sparse Index contains one entry for each page of records in the data file. The index record contains the search key and a pointer to the first data record with that search key value. A Sparse index must be clustered and it is smaller than a dense index.

Primary and secondary index

Primary index:

The primary index is an index defined on a primary key column(s) of relation with a unique constraint which guarantees that the field will not contain duplicate values and determine the order of how the records are physically stored on the disk. Note that this is also called clustered index.

This is an index on a set of fields that includes the primary key. A primary index contains records that are usually clustered. A primary index is created for the primary key of a table.

Secondary index:

The secondary index is an index defined on a non-key field which may contain duplicate values and as such does not determine the order of how the records are physically stored on a disk. It is also called the non-clustered index.

For example, in the student database, student ID is used to look up for a student as the key, however, one might want to look up for a student using LastName by creating a secondary index on that column.

A secondary index is an index that is not a primary index i.e. it does not include a primary key. A secondary index can be created on a non- key attribute. It contains duplicate data entries.

A Unique index is an index in which the search key contains some candidate key.

Evaluation

  1. Distinguish between the dense index and sparse index
  2. Explain primary and secondary index
Index using the composite search key

Composite search keys or concatenated keys are when the search key for an index contains several fields. For example, considering a collection of employee records with field name, age and salary stored in sorted order by name. if the search key is composite, an equality query is one in which each field in the search key is bound to a constant. For example, we can ask to retrieve all data entries with age = 20 and sal = 10, the hashed file organization supports only equality queries since a hash function identifies the bucket containing desired records only if a value is specified for each field in the search key.

The search key for an index can contain several fields, such keys are called Composite Search Keys or Concatenated Keys.

Range Query is the one in which not all fields in the search key are bound to constants. For example, we can ask to retrieve all data entries with age = 20; this query implies that any value is acceptable for the sal _eld. Another example of a range query is when ask to retrieve all data entries with age < 30 and sal> 40

General evaluation
  1. Differentiate between a unique index and a range query.
  2. What is the difference between primary and secondary indexes?.

Reading assignment

Understanding Data Processing for Senior Secondary Schools by Dinehin Victoria, Page 254.

Weekend assignment

  1. ………. is an index in which the search key contains some candidate key. a) Unique index  b) An index  c) composite  d) sparse index
  2. …… can be created on a non- key attribute.  a) primary index b) dense index   c) secondary index  d) sparse index
  3. A sparse index contains one entry for each ……of records in the data file. a) page b) table c) row  d) column
  4. ………is the one in which not all fields in the Search key are bound to constant. a) dense index b) composite search key c) secondary index d) range query
  5. ……. is when the search key for an index contain several fields. a) primary index b) composite search key c) secondary index d) unique index

Theory

  1. Create a student table with the following fields: name, age, and scores of 5 records. Create an index using a composite keys name and age. (show the table and SQL statements)
  2. Discuss the different types of indexing.
  3. Differentiate between a unique index and a range query.
  4. What is a composite search key?

 

In our next class, we will be talking about Maintenance of Computer: Computer Hardware, Process Of Maintaining Hardware.  We hope you enjoyed the class.

Should you have any further question, feel free to ask in the comment section below and trust us to respond as soon as possible.

Get more class notes, videos, homework help, exam practice etc on our app [CLICK HERE]

Upgrade your teaching with ready-made & downloadable class notes on our app [CLICK HERE]

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Don`t copy text!

PHP网站源码海西SEO按天收费哪家好金昌网站定制价格黄南优秀网站设计多少钱韶关网站搜索优化公司喀什seo排名哪家好赣州网站搜索优化价格吕梁SEO按天收费哪家好宁波网站开发价格景德镇企业网站建设报价兰州网站优化按天计费桂林高端网站设计哪家好济宁百度seo楚雄网站改版报价果洛百度竞价包年推广多少钱乌海百度竞价漯河企业网站制作多少钱铁岭百度爱采购哪家好太原外贸网站设计公司宜春品牌网站设计公司南京如何制作网站多少钱盐城模板网站建设价格长葛百度网站优化报价铜川至尊标王怒江网站设计模板多少钱日照网站排名优化衡阳网站推广系统报价潮州模板推广多少钱马鞍山网站建设多少钱云浮网络营销哪家好南充网站优化软件公司歼20紧急升空逼退外机英媒称团队夜以继日筹划王妃复出草木蔓发 春山在望成都发生巨响 当地回应60岁老人炒菠菜未焯水致肾病恶化男子涉嫌走私被判11年却一天牢没坐劳斯莱斯右转逼停直行车网传落水者说“没让你救”系谣言广东通报13岁男孩性侵女童不予立案贵州小伙回应在美国卖三蹦子火了淀粉肠小王子日销售额涨超10倍有个姐真把千机伞做出来了近3万元金手镯仅含足金十克呼北高速交通事故已致14人死亡杨洋拄拐现身医院国产伟哥去年销售近13亿男子给前妻转账 现任妻子起诉要回新基金只募集到26元还是员工自购男孩疑遭霸凌 家长讨说法被踢出群充个话费竟沦为间接洗钱工具新的一天从800个哈欠开始单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#中国投资客涌入日本东京买房两大学生合买彩票中奖一人不认账新加坡主帅:唯一目标击败中国队月嫂回应掌掴婴儿是在赶虫子19岁小伙救下5人后溺亡 多方发声清明节放假3天调休1天张家界的山上“长”满了韩国人?开封王婆为何火了主播靠辱骂母亲走红被批捕封号代拍被何赛飞拿着魔杖追着打阿根廷将发行1万与2万面值的纸币库克现身上海为江西彩礼“减负”的“试婚人”因自嘲式简历走红的教授更新简介殡仪馆花卉高于市场价3倍还重复用网友称在豆瓣酱里吃出老鼠头315晚会后胖东来又人满为患了网友建议重庆地铁不准乘客携带菜筐特朗普谈“凯特王妃P图照”罗斯否认插足凯特王妃婚姻青海通报栏杆断裂小学生跌落住进ICU恒大被罚41.75亿到底怎么缴湖南一县政协主席疑涉刑案被控制茶百道就改标签日期致歉王树国3次鞠躬告别西交大师生张立群任西安交通大学校长杨倩无缘巴黎奥运

PHP网站源码 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化