PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 5, 2022

[FIXED] How key-value data storage (e.g Redis) store and query data

 September 05, 2022     database, key-value, key-value-store, redis, storage     No comments   

Issue

I'm curious about how key-value data storage store their data and query on it.

Normally, when give it a key to query, it will need to loop through the data and find the matched key then get its data to response. But I saw that key-value storage can quickly find the data with the given key, so is there any way that key-value storage can jump directly to the position which hold that key?

Anyone who know this theory please explain it, a simple example will be appreciated. Thanks in advance.


Solution

Yes, the fundamental data structure involved here is a hashmap. This in contrast to arrays allows jumping directly to the key to retrieve the value. Technically stated hashmap supports O(1) lookup as opposed to an array loop which is O(n)

Most programming languages come with a hashmap built in



Answered By - Asad Awadia
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing