Postgres - Create table with foreign key constraint too slow
Your query got locked waiting for something - my bet is that it was waiting for some other transaction to finish.

When you're doing the create table, just issue (in another psql session):

select * from pg_locks where pid = XXX and not granted;


where xxx is pid of backend doing the create table.

This will show you what is the lock that the create table is waiting for.