0
0
Redisquery~10 mins

Pipeline vs individual commands performance in Redis - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send multiple commands in a pipeline.

Redis
pipe = client.pipeline()
pipe.[1]('set', 'key1', 'value1')
pipe.execute()
Drag options to blanks, or click blank then click option'
Aappend
Bset
Cget
Dsend_command
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'set' directly instead of 'send_command' inside the pipeline.
Trying to execute commands without queuing them first.
2fill in blank
medium

Complete the code to execute multiple commands individually without pipeline.

Redis
client.[1]('set', 'key1', 'value1')
client.[1]('set', 'key2', 'value2')
Drag options to blanks, or click blank then click option'
Asend_command
Bpipeline
Cexecute_command
Dmulti
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pipeline' method which batches commands instead of sending individually.
Using 'multi' which is for transactions, not individual commands.
3fill in blank
hard

Fix the error in the pipeline code to correctly queue commands.

Redis
pipe = client.pipeline()
pipe.[1]('set', 'key1', 'value1')
pipe.[1]('set', 'key2', 'value2')
pipe.execute()
Drag options to blanks, or click blank then click option'
Asend_command
Bset
Cexecute_command
Dmulti
Attempts:
3 left
💡 Hint
Common Mistakes
Calling 'set' directly on the pipeline object which causes an error.
Using 'execute_command' which sends commands immediately, not queuing.
4fill in blank
hard

Fill both blanks to create a pipeline that sets two keys and executes them.

Redis
pipe = client.[1]()
pipe.[2]('set', 'key1', 'value1')
pipe.[2]('set', 'key2', 'value2')
pipe.execute()
Drag options to blanks, or click blank then click option'
Apipeline
Bsend_command
Cexecute_command
Dmulti
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'execute_command' to queue commands instead of 'send_command'.
Not creating a pipeline object before queuing commands.
5fill in blank
hard

Fill all three blanks to send commands individually and then with pipeline.

Redis
client.[1]('set', 'key1', 'value1')
client.[1]('set', 'key2', 'value2')
pipe = client.[2]()
pipe.[3]('set', 'key3', 'value3')
pipe.execute()
Drag options to blanks, or click blank then click option'
Aexecute_command
Bpipeline
Csend_command
Dmulti
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'send_command' for individual commands instead of 'execute_command'.
Not creating a pipeline before queuing commands.
Using 'execute_command' inside the pipeline instead of 'send_command'.