Sie sind auf Seite 1von 3

1/6/2015

Whatisabitmapindex?

Translate:

SelectLanguage

Search
Home
Java
C/C++
Databases/SQL
PHP
Javascript
DataStructures
DesignPatternQuestions
OperatingSystems
Recursion
Networking
ExcelInterviewQuestions
HTML5
General/Miscellaneous
ApacheInterviewQuestions
NonTechnicalQuestions
InterviewinginIndia
WorkingAsaSoftwareEngineer
JobAdviceForProgrammers
FinancialAnalystQuestions
Puzzles
AssortmentofKnowledge
AmericanVocabulary
TechnicalVocabulary
ScienceQuestions
popup
About
searchresults
newslettersignup
Databases/SQL
SQLInterviewQuestions
Innervs.Outerjoins
SQLKeyDefinition
DifferencesbetweenPrimaryandForeignKeys
NaturalKeyInDatabase
SimplekeyinSQL
SecondaryKey
SuperkeyExample
WhatisReferentialIntegrity
Havingvs.Whereclause
Howdodatabaseindexeswork?
Whatisaselfjoin?
ExampleofDISTINCTinSQL
RetrieveuniquerowswithoutDISTINCT
PracticeInterviewQuestion1
PracticeInterviewQuestion1continued
PracticeInterviewQuestion1continued
PracticeInterviewQuestion2
PracticeInterviewQuestion2continued
AdvancedSQLInterviewQuestionsandAnswers
AdvancedSQLInterviewQuestionsandAnswers
Part2
DataMiningvs.DataWarehousing
Ternary/ThreevaluedLogicinSQL
FindMaximumValueWithoutUsingAggregate
SQLInjectionExampleandTutorial
SQLInjectionPrevention
PreparedStatementExample
ParameterizedQueriesvsPreparedStatements
BlindSQLInjectionExample
Differencebetweenaleftouterjoinandright
outerjoin?
Differencebetweenafulljoinandaninnerjoin?
Differencebetweenaleftjoinandaleftouter
join?
SQL:HavingvsGroupBy
SQL:GroupBywithmultiplecolumns
SQLSelectDistinctandOrderBy
SQLOrderBydefaultsortorder
Derivedtablevssubquery
CorrelatedvsUncorrelatedSubquery
FindnthhighestsalarySQL
CardinalityinSQL
SelectivityinSQLDatabases
CardinalityversusSelectivity
Clusteredvs.NonClusteredIndex
Pageversusblock

Get Your .COM Domain at just Rs. 99


Hover to Expand

Whatisabitmapindex?Provideasimple,easyto
understandexplanationandtutorial.
AbitmapindexisaspecialtypeofindexthatisprimarilyusedintheOracledatabase.
Herewewillgiveadetailedexplanationandtutorialofbitmapindexessoyoucanfully
understandhowtheyworkandwhenitmakessensetouseabitmapindex.

Whendoesitmakesensetouseabitmapindex?
Bitmapindexesaremeanttobeusedonlowcardinalitycolumns.Alowcardinality
columnjustmeansthatthecolumnhasrelativelyfewuniquevalues.Forexample,a
columncalledSexwhichhasonlyMaleandFemaleasthetwopossiblevaluesis
consideredlowcardinalitybecausethereareonlytwouniquevaluesinthecolumn.

Anexampleofabitmapindex
Letsgothroughamoredetailed
exampleofabitmapindex.So,lets
PartTimeJobs
saywehaveatablecalledPeople,
whereeachrowisadifferentperson,
JobsForCollegeStudents
andwehavecolumnslikeName,
Address,etc.Butletsalsosaythat
insidethePeopletablethereisa
FreeJobSearch
columncalledSexualOrientation,and
thethreepossiblevaluesare
EngineeringTrainingPrograms
heterosexual,homosexual,and
bisexual.Inthiscase,ifwecreatea
EngineeringJobs
bitmapindexonthe
SexualOrientationcolumn,thenwhat
BestComputerEngineering
exactlyhappens?Well,foreach
uniquevalueintheSexualOrientation
Programs
column,aseparateindexrecordwillbecreated.So,therewillbeoneindexrecordfor
theheterosexualvalue,anotherindexrecordforthehomosexualvalue,andathird
indexrecordforthebisexualindexrecord.Itsimportanttorememberthatallthreeof
theseindexrecordswillbeapartofthebitmapindexwearenottalkingabout
separatebitmapindexeshere,butonebitmapindexthatcontains3differentindex
records.
ads

Whatisstoredinsideabitmapindex?
So,nowwehave3indexrecordsoneforeachuniquevalueintheSexualOrientation
column.But,whatsinsideeachofthoserecords?Well,eachrecordwillhavethesame
numberofbitsasthenumberofrowsinthetable.

Howmuchspacedoesabitmapindextake?
So,letssaythatthereare1,000
rowsinthePeopletable.Then,
eachoftheserecordswillhave
roughly1,000bitsonefor
eachrowinthetable.Andthe
keypointtounderstandhereis
thateverybitcorrespondstoa
rowinthetable.Abinaryvalue
of1meansthattheparticular
indexrecordhasitsthe
correspondingrowsettothe
valuethatindexrecord
represents.A0meansthatthe
valuerepresentedbytheindex
recordisnotsetinthatrows
column.Whatdoesthatmeanin
plainEnglish?Well,letsgo
throughamoreconcreteexample.
So,letssaythatinsidethePeopletablethe10throwhastheSexualOrientationcolumn
settoheterosexualandthe11throwhastheSexualOrientationcolumnsetto

http://www.programmerinterview.com/index.php/databasesql/whatisabitmapindex/

1/3

1/6/2015

Whatisabitmapindex?

homosexual.Thismeansthattheindexrecordforheterosexualwillhaveits10th
bitsetto1andits10thbitsetto0,becausethe10throwcontainsthevalue
heterosexualsothe1indicatesthatthereisamatch.The0indicatesthatthereis
nomatch,buttheindexrecordforhomosexualwillhavea1inthe11throw,anda0
inthe10throw.

DatabaseLocking
LockEscalation
DatabaseDeadlockExample
Whatisadatabasetransaction?
SQLServerTransaction
OracleTransaction
MySQLTransaction
DB2Transaction
ConcurrentUpdateProblem
HowtoTuneDatabasePerformance
DatabaseFullTableScan
Whatiscostbasedoptimization?
HowtotuneSQLqueries
SQLIndexPerformance
Whatisabitmapindex?
OracleIndexesExamples
Systemprivilegesvs.objectprivileges
SQLGrant
SQLRevoke
SQLCreateUser
DatabaseRoles
SQLCASEStatement
SQLSearchedCASEStatement
SQLInlineView
RANK()versusDENSE_RANK()

Whyhighcardinalitycolumnsarenotgoodforbitmap
indexes
Ahighcardinalitybitmapindexwouldnotworkbecausetherewouldhavetobeanew
datastructure/indexrecordforeachuniquevalueinthecolumn(s),andiftherearealot
ofuniquevaluesthentheindexwouldtakeupwaytoomuchspaceanditwouldbevery
inefficienttohavethatindex.
600+Brands!GreatDeals!
ShopNow!!

Abitmapindexusesmatrixalgebra
Whendealingwithbitmapindexes,theRDBMSwillactuallyusematrixalgebratofind
therowsthatarebeinglookedup.

Exampleofhowtocreateabitmapindex
HereistheSQLthatcanbeusedtocreateabitmapindex:
CREATEBITMAPINDEXIX_PEOPLE_SEXUAL_ORIENTATION
ONPEOPLE(SEXUALORIENTATION);

Rs.1799

ads

PartTimeJobs

Email
Country

Rs.900Only!!

JobsForCollegeStudents

UnitedStates

FreeJobSearch

EngineeringTrainingPrograms

EngineeringJobs

ProgrammerInterview

BestComputerEngineering

Like 23,199

Programs

ads

Rs.3495

PartTimeJobs

Rs.1398Only!!

JobsForCollegeStudents
FreeJobSearch
EngineeringTrainingPrograms
EngineeringJobs
BestComputerEngineering
Programs
Hiring?JobHunting?PostaJOBoryourRESUMEonourJOBBOARD>>

Subscribetoournewsletterformorefreeinterviewquestions.
Follow@programmerintvw

+1 Recommend this on Google

FOLLOWVaroonSahgal,AuthorofProgrammerInterview on

Previous
Next

http://www.programmerinterview.com/index.php/databasesql/whatisabitmapindex/

2/3

1/6/2015

Whatisabitmapindex?
6Comments

ProgrammerInterview

Login

Share Favorite

SortbyBest

Jointhediscussion
Ankur 9monthsago

DearAdmin,
PleasecorrectthissentencewritteninBITMAPINDEX.
"Thismeansthattheindexrecordforheterosexualwillhaveits10th
bitsetto1andits10thbitsetto0,becausethe10throwcontains
thevalueheterosexualsothe1indicatesthatthereisamatch."
Imustsaythiswebsiteisveryuseful.Goodwork.
2

Reply Share

Faridon 3monthsago

howdirtyexample,maybeitwasjoke?

Reply Share

Tewwe 4monthsago

SexualOrientation,andthethreepossiblevaluesareheterosexual,
homosexual,andbisexual........IHATETHISEXAMPLEFORTHISSITE

Reply Share

Peter_FairMarket>Tewwe 2monthsago

Thendon'treadit.

Reply Share

SauravGupta 2monthsago

ThanksBuddyfortheExample.
NicelyExplained.
CanyouletmeknowanylinkwhereyouhaveexplainedforBTreeindex?
ThanksinAdvance.

Reply Share

Prasad 9monthsago

Plexplainprocessormechanismhowbitmapworksininsert/udate

Reply Share

WHAT'STHIS?

ALSOONPROGRAMMERINTERVIEW

ThreadStatesinJava

DoesJavapassbyreferenceorby
value?

3comments8monthsago

IftikharAhmedKhanMethods

12comments8monthsago

inheritedfromclass
java.lang.Objectequals,finalize,

maddyAwesomeexplainedguys

.......keepITup

DFSvs.BFS

HowtoremovewarningsinPHP?

15commentsayearago

1commentayearago

AngusChengTheexamplesof

testtestcomment

whentouseDFS/BFS'killed'me.

Subscribe

AddDisqustoyoursite

Privacy

WouldyouliketothankProgrammerInterview.comforbeingahelpfulfreeresource?Thenwhynottellafriendaboutus,or
simplyaddalinktothispagefromyourwebpageusingtheHTMLbelow.
Linkto
<ahref="http://www.programmerinterview.com/index.php/databasesql/whatisabitmapindex/">ProgrammerandSoftwareInterviewQuestionsandAnswersWhatisabitmapindex
this
page:
Pleasebookmarkwithsocialmedia,yourvotesarenoticedandappreciated:

Like 23,199peoplelikethis.

Copyright2013|ProgrammerJobBoard|IndiaJobBoardforProgrammers|About|

http://www.programmerinterview.com/index.php/databasesql/whatisabitmapindex/

3/3

Das könnte Ihnen auch gefallen