Hi, I encountered a slow execution issue when usin...
# daft-dev
c
Hi, I encountered a slow execution issue when using read_parquet + where + limit. Has anyone else encountered this problem please? https://github.com/Eventual-Inc/Daft/issues/5406
j
Hmm it might be trying to find that ID and just ends up searching the entire dataset, which is probably expected Is this a very large dataset?
When you run it without the filter, it just grabs the first few rows
c
@jay yeap, when there is a filter, the entire dataset needs to be scanned, it is very large. When there is no filter, only a single file or a few files need to be scanned. I wonder if there are any good ways to optimize it when there is a filter?
j
No great way really, there are ways to skip reading data via min/max statistics but it’s likely not getting triggered here because your ID is a UUID and is likely uniformly distributed
c
In fact, I have tried the file clipping solution, which reads metadata based on rust multi-threading and uses filter for pruning parquet files. However, the to_scan_tasks process is actually quite slow and the effect is not significant.
@jay I found that the main reason for the current slowness is that
RemoteFlotillaRunner.get_next_partition
is executed serially. When there are many partitions, it appears to be relatively slow. If the result is directly shuffled to singlepartition after locallimit, will it be faster to execute only one partition then? And it will be unnecessary to serially call
ray.get
multiple times in RemoteFlotillaRunner. Do you think this is effective?
c
parquet does support bloom filters, which I'm not sure if we leverage when doing a filter pushdown. But AFAIK, this would be the only parquet native way of improving the performance of a filter.
z
Hi @can cai,
RemoteFlotillaRunner.get_next_partition
is executed serially. When there are many partitions, it appears to be relatively slow.
RemoteFlotillaRunner.get_next_partition
should only waiting for the distributed plan finished, and in the case you showed, there should only one plan here. The detail reason might be described in #5406 as @Malcolm Greaves mentioned, and I think another slow reason might limit by your workload. May I get what's resource of you ray cluster, and whether you run the example in a local ray cluster? how many
RaySwordfishActor.run_plan
actor task running in parallel from ray dashbord? Assume the dataframe has N partitions, and there will be N SwordfishTask generated, but the max parallelism of running SwordfishTask is limited by the CPU cores of ray worker, if the CPU core is M, there should only M tasks running in parallel, the other tasks is waiting for previous tasks finished.