title: Aurora PostgreSQL Temporary storage issue for index creation
body: <p>We have migrated some of the data to PostgreSQL from MS-SQL Server. And are using R6G.Large aurora PostgreSQL RDS instance. We have transferred the data using DMS to PostgreSQL instance, and table size is around 183 GB and it has around 1.5 billion records.  Now we are trying to create a Primary Key on an Id column, but it is failing with the below error...</p>
  <blockquote>
  <p>ERROR: could not write to file &quot;base/pgsql_tmp/pgsql_tmp18536.30&quot;: No
  space left on device CONTEXT: SQL statement &quot;ALTER TABLE
  public.tbl_actions ADD CONSTRAINT tbl_actions_pkey PRIMARY KEY
  (action_id)&quot; PL/pgSQL function inline_code_block line 10 at SQL
  statement SQL state: 53100</p>
  </blockquote>
  <p>When looked at the <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Managing.html#AuroraPostgreSQL.Managing.TempStorage" rel="nofollow noreferrer">documentation</a> we found that index creation will use the temporary storage of the instance, and for r6g.large has 32 GiB. And for this huge table, that storage is not sufficient hence the index creation is failed with above error.</p>
  <p>Is there any workaround to solve this without having to upgrade the instance type, may be by changing some values in parameter group or options groups.</p>