-
-
Notifications
You must be signed in to change notification settings - Fork 48
refactor: optimized pgsql cursor extractor #2136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- added: normalize() and fromArray() methods to PostgreSQL Explain Plan classes (Cost, Timing, Buffers, PlanNode, Plan, ExplainConfig) for serialization/deserialization support - added: PHPStan type aliases (PlanNodeShape, TimingShape, BuffersShape) for improved type documentation - changed: Optimized PostgreSqlCursorExtractor to break cursor loop early when fetched rows are less than fetch size, avoiding unnecessary database round-trips
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 1.x #2136 +/- ##
==========================================
+ Coverage 82.99% 83.33% +0.33%
==========================================
Files 1178 1178
Lines 42007 42158 +151
==========================================
+ Hits 34865 35132 +267
+ Misses 7142 7026 -116
🚀 New features to boost your workflow:
|
Contributor
Flow PHP - BenchmarksResults of the benchmarks from this PR are compared with the results from 1.x branch. Extractors+--------------------------+--------------------------------+------+-----+-----------------+-------------------+--------------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+--------------------------+--------------------------------+------+-----+-----------------+-------------------+--------------------+
| CSVExtractorBench | bench_extract_10k | 1 | 2 | 6.011mb +0.00% | 304.460ms -11.30% | ±1.30% -63.31% |
| DbalExtractorBench | bench_extract_10k_keyset | 1 | 2 | 41.613mb -0.06% | 224.064ms -11.85% | ±1.51% -37.56% |
| DbalExtractorBench | bench_extract_10k_limit_offset | 1 | 2 | 41.607mb +0.00% | 196.481ms -6.72% | ±0.50% -62.89% |
| ExcelExtractorBench | bench_extract_10k_ods | 1 | 2 | 67.142mb +0.00% | 872.083ms -12.12% | ±0.89% -35.01% |
| ExcelExtractorBench | bench_extract_10k_xlsx | 1 | 2 | 67.940mb +0.00% | 1.460s -10.41% | ±1.38% +749864.36% |
| JsonExtractorBench | bench_extract_10k | 1 | 2 | 6.671mb +0.00% | 986.846ms -14.83% | ±0.37% +1095.24% |
| ParquetExtractorBench | bench_extract_10k | 1 | 2 | 11.857mb -0.71% | 8.189s -34.27% | ±0.31% -61.26% |
| PostgreSqlExtractorBench | bench_extract_10k_cursor | 1 | 2 | 43.296mb -0.01% | 238.454ms -10.34% | ±2.50% +41.81% |
| PostgreSqlExtractorBench | bench_extract_10k_keyset | 1 | 2 | 43.306mb -0.02% | 408.316ms -8.53% | ±1.00% +6.16% |
| PostgreSqlExtractorBench | bench_extract_10k_limit_offset | 1 | 2 | 43.293mb -0.03% | 347.624ms -16.77% | ±2.10% +2825.31% |
| TextExtractorBench | bench_extract_10k | 1 | 2 | 6.002mb +0.00% | 53.521ms -8.52% | ±0.15% +1172.76% |
| XmlExtractorBench | bench_extract_10k | 1 | 2 | 6.022mb +0.00% | 592.195ms -10.87% | ±0.74% +347.93% |
+--------------------------+--------------------------------+------+-----+-----------------+-------------------+--------------------+
Transformers+---------------------------------+--------------------------+------+-----+------------------+-----------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+---------------------------------+--------------------------+------+-----+------------------+-----------------+-----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1 | 2 | 182.066mb +0.00% | 89.545ms -0.83% | ±1.72% +86.72% |
| RenameEachEntryTransformerBench | bench_transform_10k_rows | 1 | 2 | 26.801mb +0.00% | 73.347ms -5.11% | ±0.14% +181.02% |
+---------------------------------+--------------------------+------+-----+------------------+-----------------+-----------------+
Loaders+-----------------------+---------------------+------+-----+------------------+-------------------+------------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-----------------------+---------------------+------+-----+------------------+-------------------+------------------+
| CSVLoaderBench | bench_load_10k | 1 | 2 | 102.107mb -0.01% | 85.110ms -23.98% | ±0.89% +98.18% |
| DbalLoaderBench | bench_load_10k | 1 | 2 | 108.490mb +0.01% | 436.302ms +2.76% | ±1.26% -41.14% |
| ExcelLoaderBench | bench_load_10k_ods | 1 | 2 | 102.563mb -0.03% | 209.825ms -22.09% | ±1.09% +1314.37% |
| ExcelLoaderBench | bench_load_10k_xlsx | 1 | 2 | 102.744mb -0.01% | 216.911ms -20.46% | ±0.18% -8.03% |
| JsonLoaderBench | bench_load_10k | 1 | 2 | 102.112mb -0.02% | 72.898ms -25.31% | ±1.28% +8.27% |
| ParquetLoaderBench | bench_load_10k | 1 | 2 | 137.539mb -5.44% | 1.876s -24.62% | ±0.11% -82.18% |
| PostgreSqlLoaderBench | bench_load_10k | 1 | 2 | 110.186mb +0.00% | 385.237ms -1.52% | ±6.37% +5673.15% |
| TextLoaderBench | bench_load_10k | 1 | 2 | 107.296mb -0.04% | 22.075ms -33.54% | ±0.26% -64.41% |
+-----------------------+---------------------+------+-----+------------------+-------------------+------------------+
Building Blocks+-------------------+-----------------------------------+------+-----+------------------+--------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-------------------+-----------------------------------+------+-----+------------------+--------------------+-----------------+
| EntryFactoryBench | bench_entry_factory | 1 | 2 | 127.837mb +0.00% | 533.551ms -6.77% | ±1.20% +32.75% |
| EntryFactoryBench | bench_entry_factory | 1 | 2 | 67.018mb +0.00% | 264.767ms -9.42% | ±0.77% +80.55% |
| EntryFactoryBench | bench_entry_factory | 1 | 2 | 18.106mb +0.00% | 60.532ms -6.76% | ±0.72% +949.58% |
| RowsBench | bench_chunk_1_000_on_10k | 1 | 2 | 111.019mb +0.02% | 330.000μs +30.43% | ±1.21% -23.33% |
| RowsBench | bench_diff_left_100_on_1k | 1 | 2 | 110.963mb +0.01% | 67.548ms -20.41% | ±0.05% -92.76% |
| RowsBench | bench_diff_right_100_on_1k | 1 | 2 | 110.848mb +0.02% | 64.624ms -12.16% | ±1.85% +85.31% |
| RowsBench | bench_drop_100_on_1k | 1 | 2 | 110.833mb -0.00% | 24.000μs +45.45% | ±4.17% +37.50% |
| RowsBench | bench_drop_right_10_on_1k | 1 | 2 | 110.800mb -0.00% | 25.000μs +51.52% | ±0.00% -100.00% |
| RowsBench | bench_entries_on_1k | 1 | 2 | 110.794mb -0.01% | 110.500μs +5.74% | ±1.36% -43.26% |
| RowsBench | bench_filter_on_1k | 1 | 2 | 110.782mb -0.00% | 785.477μs +176.10% | ±1.46% -35.92% |
| RowsBench | bench_find_on_1k | 1 | 2 | 110.772mb -0.01% | 567.975μs +85.33% | ±2.29% -48.04% |
| RowsBench | bench_find_one_on_1k | 1 | 2 | 110.771mb +0.01% | 618.020μs +105.67% | ±1.62% -35.17% |
| RowsBench | bench_first_on_1k | 1 | 2 | 110.810mb -0.05% | 3.000μs 0.00% | ±0.00% 0.00% |
| RowsBench | bench_merge_100_on_1k | 1 | 2 | 110.768mb +0.04% | 19.000μs +46.15% | ±0.00% 0.00% |
| RowsBench | bench_partition_by_on_1k | 1 | 2 | 110.871mb +0.01% | 1.702ms +11.58% | ±0.53% -76.62% |
| RowsBench | bench_schema_on_1k_identical_rows | 1 | 2 | 118.349mb -0.00% | 184.138ms -16.27% | ±0.06% -85.75% |
| RowsBench | bench_sort_asc_on_1k | 1 | 2 | 110.832mb -0.01% | 4.901ms -1.48% | ±2.88% +64.48% |
| RowsBench | bench_sort_by_on_1k | 1 | 2 | 110.856mb -0.02% | 4.661ms -6.27% | ±0.34% +113.39% |
| RowsBench | bench_sort_desc_on_1k | 1 | 2 | 110.845mb -0.02% | 4.861ms -5.99% | ±0.27% -88.43% |
| RowsBench | bench_sort_entries_on_1k | 1 | 2 | 111.660mb -0.00% | 4.999ms -1.23% | ±1.20% +2.96% |
| RowsBench | bench_unique_on_1k | 1 | 2 | 110.931mb -0.02% | 347.703ms -23.79% | ±0.49% +135.78% |
| TypeDetectorBench | bench_type_detector | 1 | 2 | 43.537mb +0.00% | 301.322ms -9.69% | ±0.44% -32.72% |
| TypeDetectorBench | bench_type_detector | 1 | 2 | 12.595mb +0.00% | 60.294ms -10.09% | ±0.05% -94.22% |
+-------------------+-----------------------------------+------+-----+------------------+--------------------+-----------------+
Parquet Library+--------------------+---------------------------------+------+-----+------------------+-------------------+------------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+--------------------+---------------------------------+------+-----+------------------+-------------------+------------------+
| ParquetWriterBench | bench_write_batch | 1 | 2 | 12.707mb -12.70% | 166.611ms -26.58% | ±0.23% +1.45% |
| ParquetWriterBench | bench_write_gzip | 1 | 2 | 11.367mb +0.02% | 194.481ms -11.16% | ±2.14% +2511.81% |
| ParquetWriterBench | bench_write_row_by_row | 1 | 2 | 12.707mb -12.70% | 168.525ms -25.78% | ±1.15% +340.57% |
| ParquetWriterBench | bench_write_snappy | 1 | 2 | 12.707mb -12.70% | 181.220ms -19.35% | ±8.42% +2235.19% |
| ParquetWriterBench | bench_write_uncompressed | 1 | 2 | 11.091mb +0.02% | 165.333ms -14.65% | ±0.38% -68.77% |
| ParquetReaderBench | bench_page_headers | 1 | 2 | 7.900mb +0.00% | 1.588s -17.16% | ±0.08% -97.48% |
| ParquetReaderBench | bench_read_metadata | 1 | 2 | 6.529mb +0.00% | 7.296ms -12.05% | ±1.53% +34.87% |
| ParquetReaderBench | bench_read_schema | 1 | 2 | 6.529mb +0.00% | 7.776ms -5.12% | ±4.66% +380.54% |
| ParquetReaderBench | bench_read_values_all_columns | 1 | 2 | 10.105mb -0.18% | 4.709s -39.22% | ±1.58% +2509.40% |
| ParquetReaderBench | bench_read_values_single_column | 1 | 2 | 7.402mb -0.25% | 198.893ms -55.45% | ±0.38% -22.96% |
| ParquetReaderBench | bench_read_values_with_limit | 1 | 2 | 7.930mb -0.39% | 16.864ms -27.75% | ±2.43% +1218.24% |
+--------------------+---------------------------------+------+-----+------------------+-------------------+------------------+
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #xxx
Change Log
Added
Changed