ohp@pyrenet.fr writes:
> I've then pg_dump'ed the database and recreate an other both on 7.3.4 and
> 7.4b
> Both are still running after more than 30 minutes of CPU (100% cpu taken)
> creating the levt_lu_ligne_evt_key.
That's hard to believe. I get
regression=# SELECT levt_lu,count(*) from ligne_evt group by levt_lu;levt_lu | count
---------+--------N | 49435O | 181242
(2 rows)
Time: 6927.28 ms
regression=# create index levt_lu_ligne_evt_key on ligne_evt (levt_lu);
CREATE INDEX
Time: 14946.74 ms
on a not-very-fast machine ... and it seems to be mostly I/O bound.
What platform are you on? I could believe that the local qsort() is
incredibly inefficient with many equal keys. Another possibility is
that you're using a non-C locale and strcoll() is horribly slow.
regards, tom lane