# Improve the performance of table functions

To improve the performance of table functions, force more efficient join orders for queries which use 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 Derby Developer's Guide for details.

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

Parent topic: Performance tips and tricks
Related concepts
Use prepared statements with substitution parameters
Create indexes, and make sure they are being used
Ensure that 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
Increase the concurrency of sequences
Shut down the system properly
Put Derby first in your classpath