Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Good morning
I have a somewhat strange problem.
I have a database with a table of more than 30 million records.
If I import the data WITHOUT FILTERS the query has no error but takes longer to update. However, the strange thing is that if I filter the table to bring me only 2 million (which are what I need) the query throws me "timeout".
Doing some research I realized that it is VERY likely because of the conditions. That is, the SQL query with an extensive "WHERE" takes me longer than bringing me the whole table.
This is somewhat rare because a query without filters is supposed to take longer.
Is this okay or is there any possible error?
Thank you very much for the answers.
I'm almost sure it's because the tables don't have indexes.
In fact I have in the base the tables without indices that I throw a query and it generates a response quite fast, but if I execute it in a view it takes me much longer.
I'm almost sure it's because of the indices.
Hi @Syndicate_Admin ,
It's possible that the query with filters is taking longer due to the conditions in the "WHERE" clause. When you apply filters, the database engine needs to evaluate the conditions, which can sometimes be more time-consuming than fetching the entire table. This can happen if the conditions involve complex operations or if the database engine is unable to use indexes efficiently.
To improve the performance of your filtered query, you can try the following:
Check if appropriate indexes are in place: Ensure that the columns used in the "WHERE" clause have proper indexes. This can help the database engine to quickly filter the records.
Optimize the conditions: If the conditions in the "WHERE" clause involve complex operations, try to simplify them or break them down into smaller parts.
Analyze the execution plan: Use tools like SQL Server Management Studio (SSMS) to analyze the execution plan of your query. This can help you identify bottlenecks and areas for optimization.
Remember that the performance of a query can be affected by various factors, such as the database engine, the structure of the table, and the available resources. It's essential to analyze the specific situation and make adjustments accordingly.
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is standard behavior when your SQL Server table is missing indexes for your condition columns. A table spool is always faster than a filtered query without indexes.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
42 | |
31 | |
27 | |
27 |