Hi Haitao,

Are you sure it's the serialization the problem? Asking this 'cause, if your database/model doesn't have an index over `eth_tx_hash`, it may take a very long time for the database to find the records you need.

(Also, maybe using `.select_related()` (https://docs.djangoproject.com/en/2.1/ref/models/querysets/#select-related) on your query may speed things up by bringing all related elements, in case your model have a few ForeignKeys or ManyToManyFields).

On Mon, Sep 10, 2018 at 6:30 AM, [email protected] wrote:
record = ExchangeCoinTransaction.objects.filter(eth_tx_hash=eth_tx_hash)
if not record:
    return False, "the eth transaction is't exchange coin transaction"
json_rec = serializers.serialize("json", record)
record = json.loads(json_rec)

#This simple query database, and serialize the results of the operation takes 3 to 4s, similar operations may take more time


--
You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django 
REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to