Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Database design with performance issue and use of views

$
0
0

I am designing database for a school system. I am having to create a lot of tables and a lot of link tables to maintain a structure in the system.

I am trying to maintain foreign integrity and trying to create unique data entry as possible. But this will create problem with queries when I start building out the system. I will have to make a lot of joins and I am afraid that this take a toll on optimization and performance.

In this instance,

I have a student who is taking a course for a subject. While he takes the course he can be borrow a book related to that subject from library.

My tables would be

a. Subjects with: id, name

b. course with: id, name, subject id

c. link table to know that the student is taking the course: id, user id, course id

d. library item table id name

e. a link table to know which library item the student is borrowing: library id, id from c

I am trying to user primary key from c because this will make sure that if the user is no longer taking the course he would not be allowed to borrow a book. The link table will cascade if the relation does not exist between the course and the user.

The problem with this is that. If i need to know the name of the subject that the student has borrowed book for. I have to join four tables. I can simply just add subject id id e to get the subject name. But that is what I hate. If this is really an issue with performance would using views make the queries faster and is it really feasible to implement views in a project.

So I guess my questions in this are,

  1. Is it really a big performance issue to make multiple tables with unique columns. I have heard indexing columns help quite a lot?

  2. Are views helpful in maintaining the relational database and making the queries faster?

  3. And in table c I have not used separate primary key id because I want to make sure that the one student can borrow one item at a time. Is this a good practice?


Viewing all articles
Browse latest Browse all 8428

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>