2 formatting
source | link

I have 10k users in my mySQL DB,MySQL database and for every user i need to store the last 500 events. Please, advice

Please advise me, how I should i design my DBdatabase? One MegaEventsTable or dedicated tabletables for every user?  
Pros of many small tables:
- i can fast pick, for example, 50 events by type from 500 entries than from 500*10k entries.
- its is faster get top 500 entries, and kill all other entries in table for this user
- i can shard my entries database some time in future
Contras

  • I can pick fast, for example, 50 events by type from 500 entries than from 500*10k entries.
  • It is faster get top 500 entries, and kill all other entries in table for this user
  • I can shard my entries database some time in future

Contras:
- i feel that 10k tables is HORRIBLE idea (and what if there will be 100K)

  • i feel that 10k tables is HORRIBLE idea (and what if there will be 100K)

I have 10k users in my mySQL DB, for every user i need to store last 500 events. Please, advice me, how should i design my DB? One MegaEventsTable or dedicated table for every user?  
Pros of many small tables:
- i can fast pick, for example, 50 events by type from 500 entries than from 500*10k entries.
- its is faster get top 500 entries, and kill all other entries in table for this user
- i can shard my entries database some time in future
Contras:
- i feel that 10k tables is HORRIBLE idea (and what if there will be 100K)

I have 10k users in my MySQL database and for every user i need to store the last 500 events.

Please advise me, how I should design my database? One MegaEventsTable or dedicated tables for every user?
Pros of many small tables:

  • I can pick fast, for example, 50 events by type from 500 entries than from 500*10k entries.
  • It is faster get top 500 entries, and kill all other entries in table for this user
  • I can shard my entries database some time in future

Contras:

  • i feel that 10k tables is HORRIBLE idea (and what if there will be 100K)
1
source | link

One table to rule them all, or thousand smaller?

I have 10k users in my mySQL DB, for every user i need to store last 500 events. Please, advice me, how should i design my DB? One MegaEventsTable or dedicated table for every user?
Pros of many small tables:
- i can fast pick, for example, 50 events by type from 500 entries than from 500*10k entries.
- its is faster get top 500 entries, and kill all other entries in table for this user
- i can shard my entries database some time in future
Contras:
- i feel that 10k tables is HORRIBLE idea (and what if there will be 100K)