Dokifansubs / anidex_www

Front end for anidex.moe
0 stars 0 forks source link

Create views. #45

Closed Orillion360 closed 9 years ago

Orillion360 commented 9 years ago

Create views in database, and split up some data.

DeathHere commented 9 years ago

views are normally used for access restrictions for users directly connecting to the database. it won't help us.

TheThing commented 9 years ago

No.

Views provide the following features:

a) They are updated on inserts (in other words, cached and ready to serve) b) They are pre-compiled queries (so custom query don't need to be compiled every time) c) They provide abstraction over your data so if we change the table layout or whatever, we would only have to update the view, not the code.

In other words: Faster, faster and better abstraction.

DeathHere commented 9 years ago

Yes.

a) They use the same table back store, thats why they are up to date. (You are prob thinking about Materialized Views, which MySQL doesn't have.) b) At best you save on a single optimization stage, you still are writing a query towards the view. Which needs to be compiled (and combined with view's SQL) c) This type of abstractions would be useful if you need change rules of something like which Hashes should the UDP tracker whitelist and if you need to change that, all you need to do is a SQL statement and not edit the code. d) You prob don't even use 5% of CPU for MySQL

In other words: Doesn't make a difference, You need a really complicated query to make a difference, useful for a few cases, worry about the DB once your looks actually get slow.

TheThing commented 9 years ago

a & b)

Fuck, you're right. I completely forgot mysql doesn't materialize the views. Too much working with CouchDB :x

c) The reason for views though was mostly though because we're still working on finalizing the database design and we are planning to re-structure or re-make some tables. It would save a lot of development time if database guys can work on their own and just update the view code instead of sending changes to be inserted by the developers.

Orillion360 commented 9 years ago

It seems we are ditching this in favour of ORM!

Orillion360 commented 9 years ago

Or not!

TheThing commented 9 years ago

It's a big decision. But this particular issue (about views) is closed for now though.