it's my update -
UPDATE "users" SET "name" = $?, "is_read" = $?, "updated_at" = $? WHERE "users"."id" = ?
and sometimes it takes about 150 seconds(but in normaly - it's fast). Could you please advise me possible reasons? users.id have index
it's my update -
UPDATE "users" SET "name" = $?, "is_read" = $?, "updated_at" = $? WHERE "users"."id" = ?
and sometimes it takes about 150 seconds(but in normaly - it's fast). Could you please advise me possible reasons? users.id have index
To speed this update, you want an index on users(id)
:
create index idx_users_id on users(id)
Normally, the id
would be declared as a primary key (or at least unique) and already have an index. But if it isn't, this should help.
Note: There are other possibilities, such as other processes having a lock on the table or very complex insert triggers.