type Hotel {
name
}
type Room {
hotel
name
}
type Ledger {
hotel
room
createdTs
amount
}
name: string @index(exact, term) .
hotel: uid @reverse .
room: uid @reverse .
createdTs: datetime @index(hour) .
amount: int @index(int) .
10.09s is too long because PostgreSQL and MSSQL could do it under 1.5s with this equivalent query:
SELECT Ht.NAME, SUM(lgr.Amount) AS TotalAmount, COUNT(lgr.LedgerID) AS TotalBill
FROM Hotel Ht
JOIN Room Rm ON Ht.HotelID = Rm.HotelID
JOIN Ledger lgr ON Ht.HotelID = lgr.HotelID AND Rm.RoomID = lgr.RoomID
WHERE Ht.NAME = 'Hotel 99'
GROUP BY Ht.NAME
I have 2 questions:
How should I optimize my queries? WIth these perf numbers… my management will likely drop Dgraph from their consideration.
Hi @geoyws, thanks for reaching out to us with above numbers. We would like to look more what is causing the slowdown. Can you somehow share you alpha p directory with us, if its testing data?
Hi @ashishgoswami, how should I share that directory? It’s about 400GB in size possibly… Yes it’s just randomly generated test data don’t worry, nothing sensitive. Would you like ssh access into the server itself?
@mrjn We’re having a meeting with @dereksfoster99 at 9pm PST to figure out the best way to run our sum queries later… will try your suggestion (don’t mind you joining in!)
@dmai Hi Daniel, this thread is also related to the script I provided you. I forgot to mention that you had the script here. I appreciate y’all taking the time. Really hoping to use Dgraph extensively here.
Hey @geoyws. Thanks for sharing your test scripts. It’ll take time for us to really dig deeper to optimize Dgraph to perform well for your specific queries. It’s not a simple task, so I’d expect at least three months for any update on this.