Hello, I need your help
I need your help. I am facing a problem, I don't know why.
For example, I have 1000 rows. For every row, I need to write in other five tables. We use SQL Server 2016 express.
I make five queries for every row for each table. The query is complex with many inner joins and subqueries and pivot and cte.
It takes about 10 min and I think it is extremely slow for 1000 rows.
In those five tables, I have indexes and clustered primary keys, I have not foreign keys.
Which you believe is the appropriate solution?
To drop indexes before insert?
To split every query of five tables into smaller and perhaps put them in views?
To use stored procedures?
To load a whole query of 1000 rows in a datatable and loop through every row?
I believe from some checks for example when I drop the indexes it was not made a big difference, it was still slow.