question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Including `id` field in query aborts "only" optimization

See original GitHub issue

In my API I have a type which is based on Django’s model using DjangoObjectType and relay.Node interface. Using the latter automatically adds the id (graphene.ID) field in the type.

class Product(DjangoObjectType):
    name = graphene.String()

    class Meta:
        interfaces = [relay.Node]
        model = models.Product

Now, when I query the API (with optimizer enabled) and include the id field in the query, the “only optimization” is aborted as a result of this check - my automatically added id field has no name. As a result, this function is called which sets the only_list to None and disables any future “only optimizations” I’d have in my case.

@tfoxy Could you validate the issue? Maybe I broke something on my side, but maybe it is a bug in the library.

Also, I don’t fully understand why do you abort the optimization and set None to the only_list. I experimented with the code and assigned [] instead of None in that function and it solved the issue.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yardensachscommented, Feb 3, 2019

@maarcingebala @tfoxy I submitted PR for this suggestion #15

0reactions
tfoxycommented, Sep 22, 2018

Maybe there can be an option to enable or disable that feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 4. Query Performance Optimization - O'Reilly
In the previous chapter, we explained how to optimize a schema, which is one of the necessary conditions for high performance. But working...
Read more >
Query Optimization Techniques in SQL Server: Parameter ...
In this blog post we will walk you through one of the SQL Query Optimization Techniques in SQL Server - Parameter Sniffing.
Read more >
Index Hints: How to Force Query Plans - MariaDB
The optimizer uses several strategies to optimize GROUP BY and ORDER BY: Resolve with an index: Scan the table in index order and...
Read more >
Understand and resolve SQL Server blocking problems
Resolve blocking issue by redesigning query and transaction. Now let's dive in to discuss how to pinpoint the main blocking session with an ......
Read more >
SQL Database Performance Tuning for Developers - Toptal
Such a trivial optimization can dramatically increase SQL query performance by updating only hundreds of rows instead of thousands. For example:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found