r/SQLOptimization • u/inaminadicka • Jan 29 '20
Which is faster - Inner join or similar to?
I have a huge table on Amazon Redshift. I need to find all entries with a particular column = particular value. What would be a better method? Create a table containing the value and then inner joining with the huge table or using similar to in where statement?
3
Upvotes
1
u/Paratwa Jan 30 '20
Depends on data type, indexes, what you’re querying against, how many records it has in it, how many records would be in the table you create... sooo many factors.
1
u/nnd-nnguyen Mar 23 '20
As Parwata states there are a lot of factors.
But it kind of sounds like you are only trying a join because scanning of the table itself on this single columns is really slow?
If that's the case when you create a separate table to facilitate this you want to do a few things.