# Improve the performance of table functions

The optimizer makes hard-coded guesses about how to calculate the cost of a user-written Derby-style table function. For this reason, the optimizer may place a table function in an inefficient position in the join order. You can give the optimizer more information so that it makes better choices. See "Programming Derby-style table functions" in the Java DB Developer's Guide for details.

Using restricted table functions can also improve performance greatly. See "Writing restricted table functions" in the Java DB Developer's Guide.

Parent topic: The tips
Related concepts
Use prepared statements with substitution parameters
Create indexes, and make sure they are being used
Ensure table statistics are accurate
Increase the size of the data page cache
Tune the size of database pages
Avoid expensive queries
Use the appropriate getXXX and setXXX methods for the type
Tune database booting/class loading
Avoid inserts in autocommit mode if possible
Configure Derby to use an in-memory database