-1

i used pymysql in my server with mysql

and the table has about 0.2 billion rows and multi PK (suppose that a, b, c col)

when i use pymysql with "SELECT * FROM table WHERE a='0' and b='1', and c='2'" query

it tooks about 40~60 sec.

but when i use sqlalchemy like

session(Table).filter(Table.a=='1', Table.b='1', Table.c='2')

it tooks about 0.00002 sec

so i changed pymysql to sqlalchemy.

but i want to know why this case happend..

plz help me

3
  • Can you share the SQLAlchemy connection string? Commented Apr 14 at 6:11
  • 1
    I don't think calling filter() method as is actually executes the underlying sql query, whereas the first syntax with pymysql does.
    – Shadow
    Commented Apr 14 at 7:32
  • i just typed like that but in my server i used the result from cursor and session. So filter() method is actually executes.. (Sry for my mistakes)
    – ys J
    Commented Apr 15 at 1:46

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.