Rel8 Performance x100 Slower than SQL #292
Replies: 8 comments
-
The first thing you should do is run both of these queries with |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I've just noticed that they are not quite equivalent:
whereas
|
Beta Was this translation helpful? Give feedback.
-
@ocharles what do I say in Rel8 to get the equivalent of |
Beta Was this translation helpful? Give feedback.
-
You can just pass a tuple of groupBy (pPeriodYear widgetsPerDay, pPeriodMonth widgetsPerDay) or maybe: groupBy (year (pPeriod widgetsPerDay), month (pPeriod widgetsPerDay)) (but I don't know what |
Beta Was this translation helpful? Give feedback.
-
This gives
versus the hand-written
|
Beta Was this translation helpful? Give feedback.
-
Let me know if you need anything else. I am assuming that this is generated by Opaleye? |
Beta Was this translation helpful? Give feedback.
-
I would imagine it's the join condition that's causing the problem. Your Rel8 one has a lot more going on with |
Beta Was this translation helpful? Give feedback.
-
I am using https://hackage.haskell.org/package/rel8-1.4.1.0 and have the following query in Haskell. Sadly it takes 180 seconds to run.
When I code up the SQL by hand it takes 3 seconds.
Here is what
showQuery
gives me:It looks very slow because there’s a query inside a query inside another query: 5 sub queries? But I am an SQL noob. Maybe I mis-formulated the Haskell?
Beta Was this translation helpful? Give feedback.
All reactions