Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Re: Re: Re: Use Placeholders. For SECURITY and (sometimes) for PERFORMANCEby mpeppler (Vicar) |
on Nov 15, 2003 at 01:12 UTC ( [id://307275]=note: print w/replies, xml ) | Need Help?? |
This is actually a common case with columns like "status" on task-tracking or ticket-tracking systems.I wanted to see how Sybase handles this case, so I did the following little test with the text_events table, which is used by Sybase to track what rows in source tables need to be updated in a Verity Full-Text index. Rows with event_status == 0 have to be processed, and there's an index on event_status. I first ran a SQL snippet like this: And this did indeed do a table scan. Then I tried a short DBI script, using placeholders: In this case the index is used every time. Then I wrote an ad-hoc stored procedure to do the same thing, and I get a table scan. Which just goes to show that this sort of thing is a bit of a black art :-) Michael
In Section
Meditations
|
|