Excessive SQL Database Row Count Heroku Costing More Money


#1

I imagine it is probably too late to change the way the sql databases are constructed with relationships and the tables it creates. However, the problem I’m having is that before when I had relationships just in a column on a table. i.e user would have a column with a foreign key column of house_id. Now Prisma creates a new table and a new row, therefore there are 2 rows for every relationship. This becomes a cost problem with services like AWS or Heroku databases where they charge per row.

This is more a concern with the general product itself and is a bit concerning tbh. Has there been any discussion around this?


#2

Hi @seawatts

Have you checked out datamodel 1.1(it is currently in beta under a prototype flag). It support inline linked relations that might solve this issue.

See: https://github.com/prisma/prisma/issues/3406

it allows you to do something like this:

type Blog {
  id: ID! @id
  posts: [Post] @relation(link: INLINE)
}

type Post {
  id: ID! @id
  title: String!
  blog: Blog
}

this will join them inline.

Also see, https://github.com/prisma/datamodel-v1.1-feedback if you want to check the beta out


#3

Wow this is exactly what I was hoping for! Thanks @pantharshit00 I’ll check it out.


#4

That worked great! Thanks again @pantharshit00