How create table in mySQL?

hi,

so i suddenly find myself in need of being able to create new server side mysql tables in code, similar to how its done locally in sqlite3.

when user register in my app, a separate user table needs to be created.

does anyone know of a way to do that in coronium?

Hello

Having 1 table per user sounds strange, but if you really wish to do this:

  1. create separate database on server

  2. use core.mysql.query( db_name, query_str ), specify database and write your script ("Create table something … ")

Hi,

Thank you for your reply.

Now that i see it I should have realized :slight_smile:

A table per user has advantages and there is no limit to the number of tables mySQL supports.

It can help improve security by not making other users tables exposed to a malicious user.

I’d save some space by not needing a user id column (a CHAR 36 type)

I suspect performance may improve a little too, and certainly not be worse.

One possible downside is i suspect RAM need will increase a little, but need to test that one to be sure.

Thanks again!

I’ll also be looking into mysql table partitioning as an alternative, so nothing is set in stone yet.

Hi,

Late reply, but I would look into table joins, etc. as an alternative to separate tables per user. Each table will consume more memory, where as an ID data field will take a negligible amount.

If your user base becomes very large you will be facing an issue in my opinion.

-dev

Hello

Having 1 table per user sounds strange, but if you really wish to do this:

  1. create separate database on server

  2. use core.mysql.query( db_name, query_str ), specify database and write your script ("Create table something … ")

Hi,

Thank you for your reply.

Now that i see it I should have realized :slight_smile:

A table per user has advantages and there is no limit to the number of tables mySQL supports.

It can help improve security by not making other users tables exposed to a malicious user.

I’d save some space by not needing a user id column (a CHAR 36 type)

I suspect performance may improve a little too, and certainly not be worse.

One possible downside is i suspect RAM need will increase a little, but need to test that one to be sure.

Thanks again!

I’ll also be looking into mysql table partitioning as an alternative, so nothing is set in stone yet.

Hi,

Late reply, but I would look into table joins, etc. as an alternative to separate tables per user. Each table will consume more memory, where as an ID data field will take a negligible amount.

If your user base becomes very large you will be facing an issue in my opinion.

-dev