yesodweb / yesodweb/persistent

Make it possible to have a table without a Primary Key

Open
#1,432 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

It would need a new constructor for EntityIdDef
I guess TH would generate something like data Key Record = NoKey
Possibly this could be table Attribute, eg no-id or no-primary-key

Motivation for this is that I have a very big table with 400_000_000 entries and the index for the autoicremental primary key alone takes 8800 MB, but is never used. I guess I could just Drop it with raw sql, but I'm afraid it will break something.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the EntityIdDef constructor and the Template Haskell generation mentioned in the issue. Check how table attributes and generated key types are represented, and whether storage backends assume an auto-incrementing primary key. Done would mean a defined, tested way to declare and use a table without that key.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.