Tablespaces

    Warning

    Django does not create the tablespaces for you. Please refer to your database engine’s documentation for details on creating and managing tablespaces.

    You can use the DEFAULT_TABLESPACE setting to specify a default value for . This is useful for setting a tablespace for the built-in Django apps and other applications whose code you cannot control.

    You can pass the db_tablespace option to an Index constructor to specify the name of a tablespace to use for the index. For single field indexes, you can pass the option to a Field constructor to specify an alternate tablespace for the field’s column index. If the column doesn’t have an index, the option is ignored.

    If db_tablespace isn’t specified and you didn’t set , the index is created in the same tablespace as the tables.

    In this example, the tables generated by the model (i.e. the model table and the many-to-many table) would be stored in the tables tablespace. The index for the name field and the indexes on the many-to-many table would be stored in the indexes tablespace. The field would also generate an index, but no tablespace for it is specified, so it would be stored in the model tablespace tables by default. The index for the shortcut field would be stored in the tablespace.

    When you use a backend that lacks support for tablespaces, Django ignores all tablespace-related options.