Is it possible to estimate how long time it will take to create an index? Is it possible to see the progress on index creation, as we can see the progrees when restoring a database (in percent (of type tinyint = no decimals))?
As Grant said, there is no way to get an estimate of how long an index will take to create. If you are inexperienced (forgive me if I am assuming, I have no way to know) and you just need a very rough rule of thumb, then I will say the only time I have ever seen it take more than 10 minutes to index a table involved a blocking process. As a general rule, unless there is a blocking process or the server is very overtaxed, an average index will take a couple of minutes or less to create.
First question, not really, no. The amount of memory, amount of data involved, contention with other resources, blocking on the table, all this and more are going to affect how long it takes to create an index. There's no way at all that I know of to estimate how long it could take. A very small index could take minutes and a very large index could take seconds, just depending on everything that is going on in the system. The second question, you can turn on STATS when running a restore. You can specify the percentage that you want to display, either 1 or 10 and it will update with those stats in a series of messages. It's not terribly accurate, but it will do what you want.
Grzegorz Popczyk pointed me towards a solution of this problem. Well, it solves 50% of the problem, as the solution only works for online index generation. But 50% is a lot more than 0 %. At ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/491616c1-f666-4b16-a5ea-1192bf156692.htm we can read about a Progress Report: Online Index Operation Event Class. So the solution to my problem:
run a trace,
include Progress Report: Online Index Operation and ...
you are able to see how far the job is. Update: I use Sp_whoIsActive to see if there is any blocking at the moment. Brilliant Sproc!