Where do I add an index on connector tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dugjohnson
    Member
    • Jan 2015
    • 38

    Where do I add an index on connector tables

    After the latest update, some of the more complex queries are taking forever and blocking other queries and making things a bit of a mess...and, yes our tables are very large.

    In going through the queries and using EXPLAIN I've found a few places where adding an index on connector tables should help. I even did a couple manually to prove the concept, but they were removed when rebuild was run.

    I know how to add indexes to tables in /custom/Espo/Custom/Resources/metadata/entityDefs but when I add a table.json for a connector table like ContactMeeting.json or EmailEmailMeeting.json, it gives an error.

    If I want to add an index to a connector table, where would I do that? Even if I need to do it in core source...though the custom area would, obviously, be better and safer
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hello,

    Edit : Sorry, not understand

    if understand .. :

    index are created in entityDefs.. in custom/Espo/Custom/Ressources/metadata/entityDefs/youEntity.php

    Need rebuild after

    sample :

    PHP Code:
    "indexes": {
    "name": {
    "columns": [
    "name",
    "deleted"
    ]
    },
    "createdAt": {
    "columns": [
    "createdAt",
    "deleted"
    ]
    },
    "assignedUser": {
    "columns": [
    "assignedUserId",
    "deleted"
    ]
    },
    "nationalNumber": {
    "columns": [
    "nationalNumber",
    "deleted"
    ]
    },
    "dateTime": {
    "columns": [
    "dateTime",
    "deleted"
    ]
    },
    "inamiNumber": {
    "columns": [
    "inamiNumber",
    "deleted"
    ]
    }
    } 
    
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • dugjohnson
      Member
      • Jan 2015
      • 38

      #3
      Yes, that would normally be the case for a "regular" table. Like a customization of Email, say.
      But there are tables that are connector tables, like email_email_address, and contact_meeting.
      Adding a file EmailEmailAddress.json with the appropriate index section does not work. In addition, I cannot find the table EmailEmailAddress.json in the Core area of the application, which makes me think that the connector tables are created differently.
      I can find references to them in sections that use those connectors to connect tables together (in this example connecting the email and the email_address table), but I haven't been able to find where those tables are created and managed

      Comment

      Working...