Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Row Level Security Performance

Status
Not open for further replies.

VergeResources

Programmer
Feb 6, 2002
40
US
I have a table with well over 10 million rows that contains statewide data. When users access this table, they should be restricted to their own agencies' data. This has been accomplished by creating a view that links their user id to a "security" table and then returns only records that match their assigned agency.

This view works, but the performance is terrible when I start using further restrictions. For instance, if I were to run a query against the true table and ask for a specific agency and date range, it takes about 5 seconds. If I use the view and ask for a date range (in a WHERE clause), it takes almost 2 minutes!

When you apply a WHERE clause to a view, don't the indexes get picked up by the SQL statement hidden in the view?

Anyone have alternate suggestions? Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top