del a string type(a little value), consume 17 milliseconds, redis version: 3.2.10

37 views
Skip to first unread message

wen...@gmail.com

unread,
Dec 28, 2017, 10:23:00 PM12/28/17
to Redis DB
so what's happen to this ?


Available since 1.0.0.

Time complexity: O(N) where N is the number of keys that will be removed. When a key to remove holds a value other than a string, the individual complexity for this key is O(M) where M is the number of elements in the list, set, sorted set or hash. Removing a single key that holds a string value is O(1).



i don't understand

hva...@gmail.com

unread,
Dec 29, 2017, 12:00:20 AM12/29/17
to Redis DB
You highlighted the part that describes what happens when the key holds a single value (a string) instead of multiple values.  The command has a time complexity of O(N).  A key that holds a single string has one value, so the time complexity is O(1).

wenk712

unread,
Dec 30, 2017, 1:35:14 AM12/30/17
to redi...@googlegroups.com
yes,i know that,but del a simple string consume 17 milliseconds 

--
You received this message because you are subscribed to a topic in the Google Groups "Redis DB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redis-db/HJ3b9oNMlWM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redis-db+unsubscribe@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

wenk712

unread,
Dec 30, 2017, 1:40:09 AM12/30/17
to redi...@googlegroups.com
i don't know where the time spent in

hva...@gmail.com

unread,
Dec 30, 2017, 4:52:15 PM12/30/17
to Redis DB
Where did you get the 17 milliseconds?  What software gave you the measurement, and exactly how are you sure the measurement didn't include the overhead of making a network connection to the Redis server before sending the command and disconnecting after the reply was received (which is a very common measuring mistake)?

wenk712

unread,
Dec 30, 2017, 9:40:17 PM12/30/17
to redi...@googlegroups.com
just get from slowlog command

--

wenk712

unread,
Dec 30, 2017, 9:43:38 PM12/30/17
to redi...@googlegroups.com
 SLOWLOG get 5

1) 1) (integer) 0
   2) (integer) 1514406777
   3) (integer) 17048
   4) 1) "DEL"
      2) "user:1000"

Tuco

unread,
Dec 30, 2017, 11:00:37 PM12/30/17
to Redis DB
i cannot comment on why it takes 17 milliseconds, but can suggest a way. 
If you are using redis version 4, you can use "unlink" command i think.
However, since you are using 3.2, you can try using "expire <key> 1", it will expire the key after a second, and will be fast i think.


On Sunday, December 31, 2017 at 8:13:38 AM UTC+5:30, wenk712 wrote:
 SLOWLOG get 5

1) 1) (integer) 0
   2) (integer) 1514406777
   3) (integer) 17048
   4) 1) "DEL"
      2) "user:1000"
On Sun, Dec 31, 2017 at 10:40 AM, wenk712 <wen...@gmail.com> wrote:
just get from slowlog command
On Sun, Dec 31, 2017 at 5:52 AM, <hva...@gmail.com> wrote:
Where did you get the 17 milliseconds?  What software gave you the measurement, and exactly how are you sure the measurement didn't include the overhead of making a network connection to the Redis server before sending the command and disconnecting after the reply was received (which is a very common measuring mistake)?

On Friday, December 29, 2017 at 10:40:09 PM UTC-8, wenk712 wrote:
i don't know where the time spent in

--
You received this message because you are subscribed to a topic in the Google Groups "Redis DB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redis-db/HJ3b9oNMlWM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redis-db+u...@googlegroups.com.

wenk712

unread,
Dec 30, 2017, 11:57:09 PM12/30/17
to redi...@googlegroups.com

happened only once so far,i just confused what can lead to this result.   maybe os or jemalloc when deallocation memory occupied by key and value


To unsubscribe from this group and all its topics, send an email to redis-db+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages