On Sun, Oct 12, 2014 at 5:17 PM, Colin Law <clanlaw@gmail.com> wrote:
> Are you sure your basic design is appropriate? Having 100,000
> associated records per user seems very high. Are you able to explain
> what is in those records in case an alternative can be suggested?
Thank you Colin! I'm implementing a railway ticket-booking system just
for learn purpose, not for production.
Now I try to explain it:
Suppose a train has 20 stations along the way. It has 1000 seats to
sell. Table A store one train's information in a row. I want table B
to store every seat's information. I design table B as follow
train_id:
start_city_id:
end_city_id:
seat_id:
availability: boolean type
date:
For one train, the number of start_city_id and end_city_id's
combinations is 19+18+...+1=190, the number of possible date is
20(people can book tickets in 20 days), and possible seat_id's number
is 1000. The total number of rows for one train is
190*1000*20=3,800,000. So huge..
Actually I have more tables in database which are omitted as they are unrelated.
Maybe I should compute the state of any seat every time the system
issues a seat? (Some words on the state of a seat: A train goes by
city L, M, N, O and there is only one seat left. If a person has
booked M->N's seat, then L->O is not available, but L->M, N->O is.)
--
Best Regards
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CALDAArrOjR83tod-JgQ--ESvMJgu0ip7nGj6i0cQibjXS5qNWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment