I really doubt about that. If null you are not supposed to join this row to another one anyway ? It would be best to take the time to understand what happens. You are producing a huge amount of rows? The fk column have an index ? If SQL Server you can use
"show plan" to better understand how the query is processed and why it is slow.
Member
359 Points
526 Posts
Null vs. Not Null (Varchar) field
Feb 07, 2019 08:07 AM|ayyappan.CNN|LINK
Hi,
Anyone, please help me,
in my SQL table, I have a Varchar null field which connects another one child table. When I execute SP, output comes 10 to 15 mins delayed
is the delay will get reduced? in-case I change null to not null?
pls advice
Dept of ICT.
Mark post(s) as "Answer" that helped you
All-Star
48490 Points
18071 Posts
Re: Null vs. Not Null (Varchar) field
Feb 07, 2019 08:55 AM|PatriceSc|LINK
Hi,
I really doubt about that. If null you are not supposed to join this row to another one anyway ? It would be best to take the time to understand what happens. You are producing a huge amount of rows? The fk column have an index ? If SQL Server you can use "show plan" to better understand how the query is processed and why it is slow.
Ah and you could try sp_recompile : https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/recompile-a-stored-procedure?view=sql-server-2017
Contributor
6101 Points
1449 Posts
Re: Null vs. Not Null (Varchar) field
Feb 07, 2019 10:16 AM|eralper|LINK
Maybe it is better to share the SP query so we can give more info about the join conditions
SQL Server 2017
Participant
1300 Points
522 Posts
Re: Null vs. Not Null (Varchar) field
Feb 08, 2019 06:40 AM|Wei Zhang|LINK
Hi ayyappan.CNN,
According to your description, Could you please post the details about your sp query?It will help us to find out the reason for delay.
Best Regards
Wei Zhang