How does arcpy communicate with SDE?

I have written a script in python and added it to a toolbox in ArcMap. I pass the feature layer that I am working on as a parameter to the script. It works but it seems to be very slow. When I run the same script on a file GDB it take maybe ten second to complete. When I run it on the same data only this time the feature class is on SDE it take 20 min. to complete. What gives? Shouldn't working on SDE be as fast if not faster than a file base Database? How do I find out what is happening?

I am running arcmap 10 latest release but not the latest SP. SDE is on 10 running on top of oracle 11 on a windows based server.

This sounds like it could be of a database issue rather than a python issue. Have you tested executing an out-of-the-box geoprocessing tool on a feature class that exists in both a File Geodatabase and an SDE Geodatabase. For example, try executing the 'Buffer' GP tool on a feature class in a File Geodatabase, then copy the feature class to SDE and execute the tool again. How do the two compare?

Also, how are you connecting to the SDE database? Are you using a direct connection or an application server connection? You can find this out by right-clicking on the SDE geodatabase > Connection Properties. Take a look at the Service.