List:Cluster« Previous MessageNext Message »
From:Martin Skold Date:January 29 2010 10:13am
Subject:Re: howto implement a fifo queue in MySQL Cluster ?
View as plain text  
Hi!

Autoincrement values are inserted in order, but we prefetch
series of values to get better performance. So if you are
inserting from several connections (or mysqld's) you will
not get a total ordering. If you want that you can set
ndb_autoincrement_prefetch_sz to 1 should force order.
This will, however, degrade performance for inserts.

BR
-- Martin
Hendrik Woltersdorf wrote:
> Hi all,
> 
> how do I implement a fifo queue in MySQL Cluster ?
> 
> What I want to do:
> 
> I write inserts and updates to some tables with triggers into a queue.
> These rows have to be read and processed in chronological order.
> My first attempt was to use a table with an autoincrement column as the
> primary key. But tests show, that these autoincrement values are not
> inserted in chronological order. A datetime column does not help either,
> because it is by far not precise enough, and it depends on the
> synchronization of the clocks of the different sql node machines.
> 
> Any ideas, how to read these data rows in chronological order ?
> 
> The second best idea is, to use "select max(PK)+1", but this will cause
> lots of duplicate key errors.
> 
> I am using MySQL Cluster version 7.0.7 with 2 data nodes, 2 management
> nodes and 2 sql nodes.
> 
> kind regards
> 
> Hendrik Woltersdorf
> XCOM AG
> Tel.: 0375/27008-580
> Tel. mobil: 0178/5710078
> Email: Hendrik.Woltersdorf@stripped
> 
> 
> 
> *** XCOM AG Legal Disclaimer ***
> 
> Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist allein
> für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist
> das Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten,
> eine fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns
> eine Nachricht zukommen zu lassen.
> 
> This email may contain material that is confidential and for the sole use
> of the intended recipient. Any review, distribution by others or forwarding
> without express permission is strictly prohibited. If you are not the
> intended recipient, please contact the sender and delete all copies.
> 
> Hauptsitz: Bahnstrasse 37, D-47877 Willich, USt-IdNr.: DE 812 885 664
> Kommunikation: Telefon +49 2154 9209-70, Telefax +49 2154 9209-900,
> www.xcom.de
> Handelsregister: Amtsgericht Krefeld, HRB 10340
> Vorstand: Matthias Albrecht, Marco Marty, Dr. Rainer Fuchs, Dirk Werner
> Vorsitzender des Aufsichtsrates: Stefan H. Tarach
Thread
howto implement a fifo queue in MySQL Cluster ?Hendrik Woltersdorf29 Jan
  • Re: howto implement a fifo queue in MySQL Cluster ?Martin Skold29 Jan
    • Antwort: Re: howto implement a fifo queue in MySQL Cluster ?Hendrik Woltersdorf29 Jan
      • Re: Antwort: Re: howto implement a fifo queue in MySQL Cluster ?Martin Skold29 Jan