这是我名为post的表
import csv
filename = "F:\\FairDealCustomerData.csv"
csvout = "F:\\FairDealCustomerDataout.csv"
with open(filename,'r',newline='') as read_file:
readCSV = csv.reader(read_file, delimiter=',')
with open(csvout,"w",newline='') as write_file:
writer = csv.writer(write_file)
for row in readCSV:
writer.writerow([row[0], row[1].split('.')[1].strip() + ' ', row[2],
row[1].split('.')[0].strip()])
write_file.close()
ALERT:please do care about with and for functionalities other wise we will get
ValueError: I/O operation on closed file
此表有500,000行
现在我想使用WHERE slug_title ='title'从该表中选择一行
从 ID (primary auto_increment) | POST | slug_title | image2 | .... |
1 hello title url ...
的slug_title ='some_title'中选择ID
此查询需要1.2秒,我看到它的时间很长,我无法 查询我写的这个更简单,那么我该如何解决呢?
我看到许多网站都有数以百万计的帖子和类似魅力的作品 我的数据库大小2 GB