This is incredibly useful. I’ve always kept a table NUMBERS that I initialized with 0 to 65535, to serve this purpose.
I assume SEQUENCE is more efficient, although I wonder how it interacts with the query optimizer?
Yes, it’s faster because you don’t need to access disk. As far as I understand, it doesn’t need to interact with the optimizer; do you have any example? If you have, I can check for you.
INSTALL PLUGIN sequence SONAME ‘ha_sequence’ works on Windows, too
i.eg there was no need to make 2 separate cases for “how to install” for either Windows or GNU Linux.
Hello! If you want to use the final count value as a variable parameter, use something like this:
… FROM (SELECT seq FROM seq_0_to_999999 WHERE seq < 30752) s
It works well fast, like sets of static strings. Yes, the design is so-so, but usable.
Pingback: FIlling in missing rows in aggregate reports using cardinal numbers
This seems like a really ugly workaround for the fact that MySQL/MariaDB doesn’t support functions that can return a result set.
This is incredibly useful. I’ve always kept a table NUMBERS that I initialized with 0 to 65535, to serve this purpose.
I assume SEQUENCE is more efficient, although I wonder how it interacts with the query optimizer?
Yes, it’s faster because you don’t need to access disk. As far as I understand, it doesn’t need to interact with the optimizer; do you have any example? If you have, I can check for you.
Pingback: MariaDB 10.0 Beta launched – an important milestone « The MariaDB Blog
INSTALL PLUGIN sequence SONAME ‘ha_sequence’ works on Windows, too
i.eg there was no need to make 2 separate cases for “how to install” for either Windows or GNU Linux.
I always used the dll, so Ihad no idea… funny! Thank you, I edited the post.