FAQ: Removing Database Fields


How do I remove fields from the database to save space?

Short Answer

Delete the database.fields entry from the profile .cfg file, and delete any xref groups and reports that use it.

Long Answer

Deleting database fields reduces the size of the database, and reduces the time required to build the database. Here's how you can delete a database field:

  1. Using a text editor, edit the .cfg file for your profile, in LogAnalysisInfo/profiles.

  2. Search for "database = {" and then search forward from there for "fields = {" to find the database fields section. Comment out the field you don't want (or delete it). For instance, to remove the screen_dimensions field, change this section:

          screen_dimensions = {
            label = "DOLLARlang_stats.field_labels.screen_dimensions"
            type = "string"
            log_field = "screen_dimensions"
            suppress_top = "0"
            suppress_bottom = "2"
            always_include_leaves = "false"
          } # screen_dimensions
    

    to this:

    #      screen_dimensions = {
    #        label = "DOLLARlang_stats.field_labels.screen_dimensions"
    #        type = "string"
    #        log_field = "screen_dimensions"
    #        suppress_top = "0"
    #        suppress_bottom = "2"
    #        always_include_leaves = "false"
    #      } # screen_dimensions
    
  3. Now that the database field is gone, you will still need to remove any references to the field from other places in the profile. Typically, there is an xref group for this field, so this needs to be removed as well. Search from the top for cross_reference_groups, and comment out the group associated with the field or delete it. For instance, for screen_dimensions field, change this section:

          screen_dimensions = {
            date_time = ""
            screen_dimensions = ""
            hits = ""
            page_views = ""
          } # screen_dimensions
    

    to this:

    #      screen_dimensions = {
    #        date_time = ""
    #        screen_dimensions = ""
    #        hits = ""
    #        page_views = ""
    #      } # screen_dimensions
    
  4. By default, there will also be a report for the field, which has to be removed. Search for "reports = {", then search forward for the appropriate report name, which is the same as the database field name. Comment it out or delete it. For instance, search for "screen_dimensions = {", and then comment it out, replacing this:

          screen_dimensions = {
            report_elements = {
              screen_dimensions = {
                label = "%7B=capitalize(pluralize(print(database.fields.screen_dimensions.label)))=}"
                type = "table"
                database_field_name = "screen_dimensions"
                sort_by = "hits"
                sort_direction = "descending"
                show_omitted_items_row = "true"
                omit_parenthesized_items = "true"
                show_totals_row = "true"
                starting_row = "1"
                ending_row = "10"
                only_bottom_level_items = "false"
                columns = {
                  0 = {
                    type = "string"
                    visible = "true"
                    field_name = "screen_dimensions"
                    data_type = "string"
                    header_label = "%7B=capitalize(database.fields.screen_dimensions.label)=}"
                    display_format_type = "string"
                    main_column = "true"
                  } # 0
                  1 = {
                    header_label = "%7B=capitalize(database.fields.hits.label)=}"
                    type = "number"
                    show_number_column = "true"
                    show_percent_column = "true"
                    show_bar_column = "true"
                    visible = "true"
                    field_name = "hits"
                    data_type = "int"
                    display_format_type = "integer"
                  } # 1
                  2 = {
                    header_label = "%7B=capitalize(database.fields.page_views.label)=}"
                    type = "number"
                    show_number_column = "true"
                    show_percent_column = "false"
                    show_bar_column = "false"
                    visible = "true"
                    field_name = "page_views"
                    data_type = "int"
                    display_format_type = "integer"
                  } # 2
                } # columns
              } # screen_dimensions
            } # report_elements
            label = "%7B=capitalize(pluralize(print(database.fields.screen_dimensions.label)))=}"
          } # screen_dimensions
    

    to this:

    #      screen_dimensions = {
    #        report_elements = {
    #          screen_dimensions = {
    #            label = "%7B=capitalize(pluralize(print(database.fields.screen_dimensions.label)))=}"
    #            type = "table"
    #            database_field_name = "screen_dimensions"
    #            sort_by = "hits"
    #            sort_direction = "descending"
    #            show_omitted_items_row = "true"
    #            omit_parenthesized_items = "true"
    #            show_totals_row = "true"
    #            starting_row = "1"
    #            ending_row = "10"
    #            only_bottom_level_items = "false"
    #            columns = {
    #              0 = {
    #                type = "string"
    #                visible = "true"
    #                field_name = "screen_dimensions"
    #                data_type = "string"
    #                header_label = "%7B=capitalize(database.fields.screen_dimensions.label)=}"
    #                display_format_type = "string"
    #                main_column = "true"
    #              } # 0
    #              1 = {
    #                header_label = "%7B=capitalize(database.fields.hits.label)=}"
    #                type = "number"
    #                show_number_column = "true"
    #                show_percent_column = "true"
    #                show_bar_column = "true"
    #                visible = "true"
    #                field_name = "hits"
    #                data_type = "int"
    #                display_format_type = "integer"
    #              } # 1
    #              2 = {
    #                header_label = "%7B=capitalize(database.fields.page_views.label)=}"
    #                type = "number"
    #                show_number_column = "true"
    #                show_percent_column = "false"
    #                show_bar_column = "false"
    #                visible = "true"
    #                field_name = "page_views"
    #                data_type = "int"
    #                display_format_type = "integer"
    #              } # 2
    #            } # columns
    #          } # screen_dimensions
    #        } # report_elements
    #        label = "%7B=capitalize(pluralize(print(database.fields.screen_dimensions.label)))=}"
    #      } # screen_dimensions
    
  5. Now you need to remove the report element from the single_page_summary report. Search for single_page_summary, then search forward for the field name (e.g., search for "screen_dimensions = {"). Again, comment out the whole report element or delete it, replacing this:

              screen_dimensions = {
                label = "%7B=capitalize(pluralize(print(database.fields.screen_dimensions.label)))=}"
                type = "table"
                database_field_name = "screen_dimensions"
                sort_by = "hits"
                sort_direction = "descending"
                show_omitted_items_row = "true"
                omit_parenthesized_items = "true"
                show_totals_row = "true"
                starting_row = "1"
                ending_row = "10"
                only_bottom_level_items = "false"
                columns = {
                  0 = {
                    type = "string"
                    visible = "true"
                    field_name = "screen_dimensions"
                    data_type = "string"
                    header_label = "%7B=capitalize(database.fields.screen_dimensions.label)=}"
                    display_format_type = "string"
                    main_column = "true"
                  } # 0
                  1 = {
                    header_label = "%7B=capitalize(database.fields.hits.label)=}"
                    type = "number"
                    show_number_column = "true"
                    show_percent_column = "true"
                    show_bar_column = "true"
                    visible = "true"
                    field_name = "hits"
                    data_type = "int"
                    display_format_type = "integer"
                  } # 1
                  2 = {
                    header_label = "%7B=capitalize(database.fields.page_views.label)=}"
                    type = "number"
                    show_number_column = "true"
                    show_percent_column = "false"
                    show_bar_column = "false"
                    visible = "true"
                    field_name = "page_views"
                    data_type = "int"
                    display_format_type = "integer"
                  } # 2
                } # columns
              } # screen_dimensions
    

    with this:

    #          screen_dimensions = {
    #            label = "%7B=capitalize(pluralize(print(database.fields.screen_dimensions.label)))=}"
    #            type = "table"
    #            database_field_name = "screen_dimensions"
    #            sort_by = "hits"
    #            sort_direction = "descending"
    #            show_omitted_items_row = "true"
    #            omit_parenthesized_items = "true"
    #            show_totals_row = "true"
    #            starting_row = "1"
    #            ending_row = "10"
    #            only_bottom_level_items = "false"
    #            columns = {
    #              0 = {
    #                type = "string"
    #                visible = "true"
    #                field_name = "screen_dimensions"
    #                data_type = "string"
    #                header_label = "%7B=capitalize(database.fields.screen_dimensions.label)=}"
    #                display_format_type = "string"
    #                main_column = "true"
    #              } # 0
    #              1 = {
    #                header_label = "%7B=capitalize(database.fields.hits.label)=}"
    #                type = "number"
    #                show_number_column = "true"
    #                show_percent_column = "true"
    #                show_bar_column = "true"
    #                visible = "true"
    #                field_name = "hits"
    #                data_type = "int"
    #                display_format_type = "integer"
    #              } # 1
    #              2 = {
    #                header_label = "%7B=capitalize(database.fields.page_views.label)=}"
    #                type = "number"
    #                show_number_column = "true"
    #                show_percent_column = "false"
    #                show_bar_column = "false"
    #                visible = "true"
    #                field_name = "page_views"
    #                data_type = "int"
    #                display_format_type = "integer"
    #              } # 2
    #            } # columns
    #          } # screen_dimensions
    #        } # report_elements
    
  6. Finally rebuild the database.