Web Dev CodyW
Convex Community3y ago
2 replies
Web Dev Cody

model relationships, are there benefits to using v.id?

I have a simple schema

import { defineSchema, defineTable } from 'convex/server';
import { v } from 'convex/values';

export default defineSchema({
  plans: defineTable({
    userId: v.string(),
    idea: v.string(),
    targetUser: v.string(),
    plan: v.any(),
    version: v.number(),
  }),
  users: defineTable({
    userId: v.string(),
    credits: v.number(),
  }),
});


I'm curious if there is a performance benefit to instead have the userId on plan be v.id("plans") or if this approach will basically work the same (assuming I add an index)?
Was this page helpful?