SQL Table Functions - do they scale well, is there an efficient way to emulate them in MySQL

I have an application that groups orders in many different ways (by company, store, warehouse, account). I have used a MS SQL table function to gather the appropriate account IDs and join that table function to my primary order table to make sure the user is exposed to the appropriate orders. This has worked well as it saves me from have to have 20 variations of every select stored proc in the application but I have two questions -

Is this scale-able if the database grows up to 50 million rows in the order table?

Is there a way to do this in MySQL?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Data DudeCommented:
>do they scale well

>it saves me from have to have 20 variations of every select stored proc in the application
This is the good.

The bad is: The problem with TVF's is that the query engine can't use the TVF in determining the execution plan, so queries may not execute in the fastest way possible.  

Not sure about MySQL.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott PletcherSenior DBACommented:
It depends.  In-line TVFs are extremely efficient and will scale nicely.  Multi-line TVFs are inefficient and will not scale well at all.

I have no idea for MySQL.
justinfilmerAuthor Commented:
I was unaware that stored procs using table functions would not cache. I will post again to try to find my options in MySQL.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.