Geen cache-versie.


Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code DEF204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher dans le manuel MySQL

15.19.4 InnoDB memcached Multiple get and Range Query Support

The daemon_memcached plugin supports multiple get operations (fetching multiple key-value pairs in a single memcached query) and range queries.

Multiple get Operations

The ability to fetch multiple key-value pairs in a single memcached query improves read performance by reducing communication traffic between the client and server. For InnoDB, it means fewer transactions and open-table operations.

The following example demonstrates multiple-get support. The example uses the test.city table described in Creating a New Table and Column Mapping.

  1. mysql> USE test;
  2. mysql> SELECT * FROM test.city;
  3. +---------+-----------+-------------+---------+-------+------+--------+
  4. | city_id | name      | state       | country | flags | cas  | expiry |
  5. +---------+-----------+-------------+---------+-------+------+--------+
  6. | B       | BANGALORE | BANGALORE   | IN      |     0 |    1 |      0 |
  7. | C       | CHENNAI   | TAMIL NADU  | IN      |     0 |    0 |      0 |
  8. | D       | DELHI     | DELHI       | IN      |     0 |    0 |      0 |
  9. | H       | HYDERABAD | TELANGANA   | IN      |     0 |    0 |      0 |
  10. | M       | MUMBAI    | MAHARASHTRA | IN      |     0 |    0 |      0 |
  11. +---------+-----------+-------------+---------+-------+------+--------+

Run a get command to retrieve all values from the city table. The results are returned in a key-value pair sequence.

telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
get B C D H M
VALUE B 0 22
BANGALORE|BANGALORE|IN
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
VALUE M 0 21
MUMBAI|MAHARASHTRA|IN
END

When retrieving multiple values in a single get command, you can switch tables (using @@containers.name notation) to retrieve the value for the first key, but you cannot switch tables for subsequent keys. For example, the table switch in this example is valid:

get @@aaa.AA BB
VALUE @@aaa.AA 8 12
HELLO, HELLO
VALUE BB 10 16
GOODBYE, GOODBYE
END

Attempting to switch tables again in the same get command to retrieve a key value from a different table is not supported.

Inhoudsopgave Haut

Range Queries

For range queries, the daemon_memcached plugin supports the following comparison operators: <, >, <=, >=. An operator must be preceded by an @ symbol. When a range query finds multiple matching key-value pairs, results are returned in a key-value pair sequence.

The following examples demonstrate range query support. The examples use the test.city table described in Creating a New Table and Column Mapping.

  1. mysql> SELECT * FROM test.city;
  2. +---------+-----------+-------------+---------+-------+------+--------+
  3. | city_id | name      | state       | country | flags | cas  | expiry |
  4. +---------+-----------+-------------+---------+-------+------+--------+
  5. | B       | BANGALORE | BANGALORE   | IN      |     0 |    1 |      0 |
  6. | C       | CHENNAI   | TAMIL NADU  | IN      |     0 |    0 |      0 |
  7. | D       | DELHI     | DELHI       | IN      |     0 |    0 |      0 |
  8. | H       | HYDERABAD | TELANGANA   | IN      |     0 |    0 |      0 |
  9. | M       | MUMBAI    | MAHARASHTRA | IN      |     0 |    0 |      0 |
  10. +---------+-----------+-------------+---------+-------+------+--------+

Open a telnet session:

telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

To get all values greater than B, enter get @>B:

get @>B
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
VALUE M 0 21
MUMBAI|MAHARASHTRA|IN
END

To get all values less than M, enter get @<M:

get @<M
VALUE B 0 22
BANGALORE|BANGALORE|IN
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
END

To get all values less than and including M, enter get @<=M:

get @<=M
VALUE B 0 22
BANGALORE|BANGALORE|IN
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
VALUE M 0 21
MUMBAI|MAHARASHTRA|IN

To get values greater than B but less than M, enter get @>B@<M:

get @>B@<M
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
END

A maximum of two comparison operators can be parsed, one being either a 'less than' (@<) or 'less than or equal to' (@<=) operator, and the other being either a 'greater than' (@>) or 'greater than or equal to' (@>=) operator. Any additional operators are assumed to be part of the key. For example, if you issue a get command with three operators, the third operator (@>C) is treated as part of the key, and the get command searches for values smaller than M and greater than B@>C.

get @<M@>B@>C
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN

Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-innodb-memcached-multiple-get-range-query.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut