statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
104 stars 74 forks source link

Performance issues with blueprint as JSON field #126

Closed ryanmitchell closed 1 year ago

ryanmitchell commented 1 year ago
          @ryanmitchell @jasonvarga we're facing rather big performance issues with `blueprint` being stored in json instead of its own field, so I just wanted to hear you out if you're okay with pulling `blueprint` out of json with an index so queries don't take 5+ seconds to complete?

Originally posted by @FrittenKeeZ in https://github.com/statamic/eloquent-driver/issues/114#issuecomment-1420531869

ryanmitchell commented 1 year ago

I assume you're talking about queries you're writing rather than ones this driver is making?

if so, what about making it a storedAs column in your own migration - that allows you to query it independently but it's still using the JSON field field so the driver's code doesn't need to change.

FrittenKeeZ commented 1 year ago

It's also when using entries fieldtype for relationships with the blueprint filter. Another issue is trying to query entries for a specific site with a certain blueprint - right now you're forced to fetch the original, loop through them to get the localized entry, and filter whether they're published or not, which is rather cumbersome.

ryanmitchell commented 1 year ago

The localised entries issue should be solved by the data propagation PR which is open at the moment.