Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some queries take 7s! #257

Open
vikiival opened this issue Apr 21, 2023 · 3 comments
Open

Some queries take 7s! #257

vikiival opened this issue Apr 21, 2023 · 3 comments

Comments

@vikiival
Copy link
Member

vikiival commented Apr 21, 2023

duration: 6440.601 ms execute <unnamed>:

  SELECT DISTINCT ne.id AS id,
                ne.name AS name,
                ne.issuer AS issuer,
                ne.metadata AS metadata,
                e.current_owner,
                me.image AS image,
                me.animation_url,
                MAX(e.timestamp) AS timestamp,
                MAX(e.meta::decimal) AS value,
                ne.collection_id AS collection_id,
                ce.name AS collection_name
  FROM event e
  JOIN nft_entity ne ON e.nft_id = ne.id
  LEFT JOIN metadata_entity me ON me.id = ne.metadata
  LEFT JOIN collection_entity ce ON ne.collection_id = ce.id
  WHERE e.interaction = $1
    AND ne.burned = FALSE

  GROUP BY ne.id,
          me.id,
          e.current_owner,
          me.image,
          ce.name
  ORDER BY MAX(e.timestamp) DESC
  LIMIT $2
  OFFSET $3
 {"detail":"parameters: $1 = 'LIST', $2 = '8', $3 = '0'"}
@vikiival
Copy link
Member Author

cc @Matehoo

@vikiival
Copy link
Member Author

vikiival commented May 26, 2023

So refactoring async lastEvent resolver:

Query should be:

Return last n events where interaction = ineraction
and NFT cannot be burned

Ideally check lastNftListByEvent on kodadot/nft-gallery for usage

@roiLeo
Copy link
Contributor

roiLeo commented Jun 1, 2023

maybe check if e.interaction is indexed (timestamp too?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants