Redis SORT排序命令使用方法详解(2)_MySQL教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:mysql多表随机查询优化方案
我以前介绍过最多的就是单表随机查询时的优化了,今天 看到一站长分享了一个多表随机查询优化的一些方法与方案,下面我们就一起来看看吧. 本文主要谈论如何实现Mysql的随机查询,多表随机查询。在Mysql中随机取出一条记录的实现方法。 我们通常的查询是没有where或者wh

  ZRANGEBYSCORE key min max 返回所有符合score >= min和score <= max的成员 ZCARD key 返回有序集合的元素数量 ZSCORE key element 返回指定成员的SCORE值 ZREMRANGEBYSCORE key min max 删除符合 score >= min 和 score <= max 条件的所有成员

  6,hash类型

  Command Parameters Description

  HSET key field value Set the hash field to the specified value. Creates the hash if needed.

  HGET key field Retrieve the value of the specified hash field.

  HMGET key field1 … fieldN Get the hash values associated to the specified fields.

  HMSET key field1 value1 … fieldN valueN Set the hash fields to their respective values.

  HINCRBY key field integer Increment the integer value of the hash at key on field with integer.

  HEXISTS key field Test for existence of a specified field in a hash

  HDEL key field Remove the specified field from a hash

  HLEN key Return the number of items in a hash.

  HKEYS key Return all the fields in a hash.

  HVALS key Return all the values in a hash.

  HGETALL key Return all the fields and associated values in a hash.

  7,排序(List, Set, Sorted Set)

  SORT key BY pattern LIMIT start end GET pattern ASC|DESC ALPHA 按照指定模式排序集合或List

  SORT mylist DESC 降序

  SORT mylist LIMIT 0 10 从序号0开始,取10条

  SORT mylist LIMIT 0 10 ALPHA DESC 按首字符排序

  SORT mylist BY weight_* STORE resultkey 将返回的结果存放于resultkey序列(List)

  8,持久控制

  SAVE 同步保存数据到磁盘

  BGSAVE 异步保存数据到磁盘

  LASTSAVE 返回上次成功保存到磁盘的Unix时间戳

  SHUTDOWN 同步保存到服务器并关闭 Redis 服务器(SAVE+QUIT)

  BGREWRITEAOF 当日志文件过长时重写日志文件

  9,远程控制命令

  INFO 提供服务器的信息和统计信息

  MONITOR 实时输出所有收到的请求

  SLAVEOF 修改复制选项

分享:通过frm&ibd 恢复 Mysql ibdata 丢失或损坏的数据教程
有时候mysql没有做好数据备份,或者被数据管理员误删,或者ibdata损坏了我们如何恢复呢?别怕,只要有部分frm、ibd存在,下面就是恢复教程。 mysql存储在磁盘中,各种天灾人祸都会导致数据丢失。大公司的时候我们常常需要做好数据冷热备,对于小公司来说要做好所有数据

共2页上一页12下一页
来源:模板无忧//所属分类:MySQL教程/更新时间:2015-02-10
相关MySQL教程