... | ... | @@ -2,20 +2,20 @@ |
|
|
|
|
|
## Optimizing database access
|
|
|
|
|
|
Drupal's flexibility tends to add a lot of redundant queries, which can greatly affect the performance of your instance, especially if your instance is heavily used.
|
|
|
Drupal's flexibility tends to add a lot of redundant queries, which can greatly affect the performance of your instance, especially if your instance is heavily used.
|
|
|
|
|
|
You can especially run into this type of query, run at each page call :
|
|
|
You can especially run into this type of query, run at each page call :
|
|
|
```sql
|
|
|
SELECT t.word AS realword, i.word
|
|
|
FROM search_total t
|
|
|
LEFT JOIN search_index i
|
|
|
FROM search_total t
|
|
|
LEFT JOIN search_index i
|
|
|
ON t.word = i.word
|
|
|
WHERE i.word IS NULL;
|
|
|
```
|
|
|
|
|
|
Which you can easily solve this by adding the following index to your database (Postgres here, which is recommanded) :
|
|
|
Which you can easily solve this by adding the following index to your database (Postgres here, which is recommanded) :
|
|
|
```sql
|
|
|
CREATE INDEX
|
|
|
IF NOT EXISTS locales_source_source_context_textgroup_idx
|
|
|
CREATE INDEX
|
|
|
IF NOT EXISTS locales_source_source_context_textgroup_idx
|
|
|
ON locales_source (source, context, textgroup);
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
``` |