Comments (7)
What's generating this query? Is it something in your application? Is it something in this package? If it's in this package, what is it?
Because you're doing wildcard LIKE conditions on every column in the table, I don't find it too surprising that it's somewhat slow and this query would be better written only targeting needed columns, and for columns with fixed values (i.e. the action
column can only be one of a handful of strings) making sure you're only querying for one of those values.
from doctrineextensions.
I changed the query a bit to run on console for postgres 16.
FROM ext_log_entries
WHERE (id = 100 OR LOWER(action) LIKE '%100%' OR LOWER(object_id) LIKE '%100%' OR LOWER(object_class) LIKE '%100%' OR version = 100 OR LOWER(data) LIKE '%100%' OR LOWER(username) LIKE '%100%') AND username IS NOT NULL
ORDER BY id DESC
LIMIT 30;```
370.000 Entries. It took 55ms
This is not an issue of this repo.
from doctrineextensions.
@wehostadm, the field action is not indexed by default.
from doctrineextensions.
@mbabker It is the Easyadmin Bundle that do this query, I have no control of that :(
@ytilotti How can I add the index on "action" field in Symfony because I do not managed the Gedmo\Loggable\Entity\LogEntry
that is inside this bundle ?
Thanks all,
from doctrineextensions.
@wehostadm you manage the structure of LogEntry via migrations doctrine.
from doctrineextensions.
@ytilotti Only for entities that I managed not for those inside Bundles. Do I need to create an Entity that inherits Gedmo\Loggable\Entity\LogEntry
?
Somethink like :
#[ORM\Index(name: 'action_lookup_idx', columns: ['action'])]
class MyLogEntity extends Gedmo\Loggable\Entity\LogEntry
?
from doctrineextensions.
I don't use EasyAdmin so I don't know how much help I could offer here, but based on ~5 minutes of looking at a couple of screenshots and the filters docs, it seems like there'd be ways to better build the filters for a log entry list (as I'm assuming you've added a section that lets you browse Gedmo\Loggable\Entity\LogEntry
records).
- For the
action
field, use aChoiceFilter
instead of the default text filter so filtering on that column is narrowed down to one of the known allowed values and not a LIKE condition - Similar for the
object_class
field, I'd use aChoiceFilter
where the options are the list of entities that you have logging enabled for (and even if it's all of your app's entities, the choice filter would still write a better query than a LIKE condition)
The worst field to try and support filtering for is the data
field because it's just an inconsistently serialized array, that's just never going to create a great query.
As far as the custom entity goes, yes, that should do the trick. The other thing is to make sure you've added the logEntryClass
config to the attribute on all of your loggable entities so the extension knows to use your custom class, otherwise it'll continue using the default one from here.
from doctrineextensions.
Related Issues (20)
- in Symfony 7 annotation_reader no exists
- [Loggable] Add option to store prev data
- The bundle not set automatcly the value to updated_at and created_at columns when persisting data HOT 6
- Missing Reference Listener in the documentation
- [Tree] [materializedPath] Deleting parent removes children when onDelete="restrict" HOT 2
- Cannot get DoctrineExtensions to work with Symfony 7 HOT 3
- The service "gedmo.listener.softdeleteable" has a dependency on a non-existent service "annotation_reader". HOT 2
- Timestampable issue mapping expects array HOT 2
- LogEntryInterface::getObjectClass() @phpstan-return is missing null HOT 2
- [Tree] Missing path value on insert a new document HOT 2
- Error for symfony v7 HOT 5
- A [SoftDeleteable] cycle has been detected, so a topological sort is not possible. The getCycle() method provides the list of nodes that form the cycle.
- Timestamble error getRawDateValue HOT 10
- Can't escape quote in orderby with the function INSTR() HOT 1
- Declaration of Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter::addFilterConstraint not compatible with Doctrine\ORM\Query\Filter\SQLFilter::addFilterConstraint HOT 2
- XSD out of sync with mapping drivers
- Any plans to release a new version compatible with doctrine 3.x? HOT 12
- Library is not compatible with doctrine/dbal ^4 HOT 4
- [Tree] parent parameter typing in updateNode method (Nested strategy) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctrineextensions.