ICT Role in 21st Century Education & its Challenges.pptx
Guidelines for indexing and tools
1. NADAR SARASWATHI COLLEGE OF
ARTS AND SCIENCES, THENI.
GUIDELINE FOR INDEXING AND TOOLS FOR
WORKING WITH BIG DATA
A.NAGA
IMSC CS
2. Introduction:
Indexing is a great technique to help to search the required
documents efficiently.
Here instead of performing a total database scan (scanning through
every document), you searched through the ordered index first
thereby gaining the performance.
3. MongoDB supports creating or dropping indexes considering query
patterns.
Today in this article, we will cover below aspects,
•Basic Indexes Benefits
•Indexes as AntiPattern
•Indexes are resource-intensive
•High Write-to-Read ratio
•Use Compound Indexes over Individual Field indexes
•Understand your Query pattern
•Remove Unnecessary Indexes
•Use Proper Type of Indexes
•Use Properties of Indexes
•Case Sensitive Indexes
• Index Name Length
4. Basic Indexes Benefits
•Indexing supports the efficient execution of queries.
•It’s the best means of controlling the database scan.
•Lets you control the scan of every document
efficiently. Please note without indexes each and every
document will do a full scan in a collection.
•Indexing helps to limit the number of documents it
must inspect.
5. Indexes as AntiPattern
Every good pattern has the ability to behave as an Antipattern
if not used correctly for the given use case or context of the
issue you are trying to solve.
•Don’t create Indexes if using them rarely.
•Do Not duplicate indexes of indexes that already exist in the
form of other indexes. Example Compound indexes etc.
•Build indexes on only fields that are used often in the query.
6. High Write-to-Read ratio
In Collections with a high write-to-read ratio, each write
operation will be required to update indexes as well for the
given documents. This could cause negative performance
for write operations.
The same is different for the collection with a High Read-
to-Write ratio.
Such read operations often gain performance when used
with indexes
7. Understand your Query pattern
Before you could create indexes you must analyze the query
pattern.
Having proper execution statistics of a query will help you
come up with better indexes.
You can always analyze a query with and without an index to
come up with better indexes.
Use inbuilt and automated methods from MongoDB to
provide you with the statistics.
•cursor.explain("executionStats")
•db.collection.explain("executionStats")
8. Case Sensitive Indexes
Case-Insensitive Queries without Case-Insensitive Indexes
could result in a slow query.
As a good measure, one can create Case-Insensitive
Indexes for better performance query execution.
A query with the same collation as a case-insensitive
index returns a case-insensitive result and executes very
speedily.