Anyone know how I could insert 120k rows into an s...
# orm-help
w
Anyone know how I could insert 120k rows into an sqlite table? If I call
create({ data: ... })
on every record I get this issue:
Copy code
[Ingest] [ship-kills] 793828176027320321n failed PrismaClientUnknownRequestError: 
Invalid `this.GalaxyInfo.prisma.kills.create()` invocation in
/home/wingy/Code/Personal/Discord Bots/galaxy-info-v2/dist/ingest/shipKills.js:138:64

  135 if (!firstMessage || messages.map(message => message.id).includes(mostRecentKillId)) {
  136     for (const kill of alreadyParsed) {
  137         try {
→ 138             await this.GalaxyInfo.prisma.kills.create(
  Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteFailure(Error { code: DatabaseCorrupt, extended_code: 11 }, Some("database disk image is malformed"))) })
    at cb (/home/wingy/Code/Personal/Discord Bots/galaxy-info-v2/node_modules/@prisma/client/runtime/index.js:38541:17)
    at async fetchOldKills (/home/wingy/Code/Personal/Discord Bots/galaxy-info-v2/dist/ingest/shipKills.js:138:29) {
  clientVersion: '3.3.0'
}
Is this too much for sqlite? Would I be better off using postgres?
āœ… 1
Turned out that not using an index on the table fixed it in my case
šŸ‘ 1
if they're needed for performance, maybe remove the index, do the insert spam, then add the index back.