I need to have a sequence number (not for primary key nor auto_increment) in MariaDB using Galera Cluster.
I was thinking of having a table with sequence name, current value and using stored procedures to return the next value.
I am not sure a Galera Cluster will support this (http://www.sqlines.com/oracle-to-mysql/sequence):
CREATE FUNCTION NextVal (vname VARCHAR(30))
RETURNS INT
BEGIN
UPDATE _sequences
SET next = (@next := next) + 1
WHERE name = vname;
RETURN @next;
END
It works in my tests but I don´t know if I can guarantee this. Should I continue this path or should I take care of this another way?