西维蜀黍

【Redis】数据类型的底层数据结构 - String

  ...


【Redis】数据类型的底层数据结构 - ZSet

跳跃表(跳表,Skiplist)

引言

Redis因为其完全基于内存、性能出色,加上具备丰富的数据类型,在电商环境中深受后端开发的喜爱。其中有序集合zset就是基本数据类型之一,并且每个member都带有score(可用于排序),因此很适合在打赏日榜、近一周收益这类场景中运用。

跳表的定义

跳表:增加了向前指针的链表叫做指针。跳表全称叫做跳跃表,简称跳表。跳表是一个随机化的数据结构,实质是一种可以进行二分查找的有序链表。跳表在原有的有序链表上增加了多级索引,通过索引来实现快速查询。跳表不仅能提高搜索性能,同时也可以提高插入和删除操作的性能。

跳表是一个随机化的数据结构,可以被看做二叉树的一个变种,它在性能上和红黑树、AVL树不相上下,但是跳表的原理非常简单,目前在Redis和LevelDB中都有用到。

  ...


【Hackintosh】硬件购买指南

网卡

Ref

  ...


【Golang】Prepared Statements in Golang

Background

What is a prepared statement?

A prepared statement is SQL that is parsed and saved by the DBMS, typically containing placeholders but with no actual parameter values. Later, the statement can be executed with a set of parameter values.

  ...


【MySQL】Prepared Statements

Prepared Statements

MySQL 8.0 provides support for server-side prepared statements. This support takes advantage of the efficient client/server binary protocol. Using prepared statements with placeholders for parameter values has the following benefits:

  • Less overhead for parsing the statement each time it is executed. Typically, database applications process large volumes of almost-identical statements, with only changes to literal or variable values in clauses such as WHERE for queries and deletes, SET for updates, and VALUES for inserts.
  • Protection against SQL injection attacks. The parameter values can contain unescaped SQL quote and delimiter characters.

In order to use MySQL prepared statement, you use three following statements:

  • PREPARE – prepare a statement for execution.
  • EXECUTE – execute a prepared statement prepared by the PREPARE statement.
  • DEALLOCATE PREPARE – release a prepared statement.

The following diagram illustrates how to use a prepared statement:

  ...