]> granicus.if.org Git - postgresql/blob - doc/TODO
Update:
[postgresql] / doc / TODO
1
2 PostgreSQL TODO List
3 ====================
4 Current maintainer:     Bruce Momjian (pgman@candle.pha.pa.us)
5 Last updated:           Sat Aug 27 09:38:42 EDT 2005
6
7 The most recent version of this document can be viewed at
8 http://www.postgresql.org/docs/faqs.TODO.html.
9
10 #A hyphen, "-", marks changes that will appear in the upcoming 8.1 release.#
11 #A percent sign, "%", marks items that are easier to implement.#
12
13 Bracketed items, "[]", have more detail.
14
15 This list contains all known PostgreSQL bugs and feature requests. If
16 you would like to work on an item, please read the Developer's FAQ
17 first.
18
19
20 Administration
21 ==============
22
23 * %Remove behavior of postmaster -o after making postmaster/postgres
24   flags unique
25 * %Allow pooled connections to list all prepared queries
26
27   This would allow an application inheriting a pooled connection to know
28   the queries prepared in the current session.
29
30 * Allow major upgrades without dump/reload, perhaps using pg_upgrade 
31   [pg_upgrade]
32 * Check for unreferenced table files created by transactions that were
33   in-progress when the server terminated abruptly
34 * Allow administrators to safely terminate individual sessions either
35   via an SQL function or SIGTERM 
36
37   Lock table corruption following SIGTERM of an individual backend
38   has been reported in 8.0.  A possible cause was fixed in 8.1, but
39   it is unknown whether other problems exist.  This item mostly
40   requires additional testing rather than of writing any new code.
41
42 * %Set proper permissions on non-system schemas during db creation
43
44   Currently all schemas are owned by the super-user because they are
45   copied from the template1 database.
46
47 * Support table partitioning that allows a single table to be stored
48   in subtables that are partitioned based on the primary key or a WHERE
49   clause
50
51
52 * Improve replication solutions
53
54         o Load balancing
55
56           You can use any of the master/slave replication servers to use a
57           standby server for data warehousing. To allow read/write queries to
58           multiple servers, you need multi-master replication like pgcluster.
59
60         o Allow replication over unreliable or non-persistent links
61
62
63 * Configuration files
64
65         o %Add "include file" functionality in postgresql.conf
66         o %Allow commenting of variables in postgresql.conf to restore them
67           to defaults
68
69           Currently, if a variable is commented out, it keeps the
70           previous uncommented value until a server restarted.
71
72         o %Allow pg_hba.conf settings to be controlled via SQL
73
74           This would add a function to load the SQL table from
75           pg_hba.conf, and one to writes its contents to the flat file.
76           The table should have a line number that is a float so rows
77           can be inserted between existing rows, e.g. row 2.5 goes
78           between row 2 and row 3.
79
80         o %Allow postgresql.conf file values to be changed via an SQL
81           API, perhaps using SET GLOBAL
82         o Allow the server to be stopped/restarted via an SQL API
83         o Issue a warning if a change-on-restart-only postgresql.conf value
84           is modified  and the server config files are reloaded
85         o Mark change-on-restart-only values in postgresql.conf
86
87
88 * Tablespaces
89
90         * Allow a database in tablespace t1 with tables created in
91           tablespace t2 to be used as a template for a new database created
92           with default tablespace t2
93
94           All objects in the default database tablespace must have default
95           tablespace specifications. This is because new databases are
96           created by copying directories. If you mix default tablespace
97           tables and tablespace-specified tables in the same directory,
98           creating a new database from such a mixed directory would create a
99           new database with tables that had incorrect explicit tablespaces.
100           To fix this would require modifying pg_class in the newly copied
101           database, which we don't currently do.
102
103         * Allow reporting of which objects are in which tablespaces
104
105           This item is difficult because a tablespace can contain objects
106           from multiple databases. There is a server-side function that
107           returns the databases which use a specific tablespace, so this
108           requires a tool that will call that function and connect to each
109           database to find the objects in each database for that tablespace.
110
111         o %Add a GUC variable to control the tablespace for temporary objects
112           and sort files
113
114           It could start with a random tablespace from a supplied list and
115           cycle through the list.
116
117         o Allow WAL replay of CREATE TABLESPACE to work when the directory
118           structure on the recovery computer is different from the original
119
120         o Allow per-tablespace quotas
121
122
123 * Point-In-Time Recovery (PITR)
124
125           o Allow point-in-time recovery to archive partially filled
126             write-ahead logs [pitr]
127
128             Currently only full WAL files are archived. This means that the
129             most recent transactions aren't available for recovery in case
130             of a disk failure. This could be triggered by a user command or
131             a timer.
132
133           o Automatically force archiving of partially-filled WAL files when
134             pg_stop_backup() is called or the server is stopped
135
136             Doing this will allow administrators to know more easily when
137             the archive contins all the files needed for point-in-time
138             recovery.
139
140           o %Create dump tool for write-ahead logs for use in determining
141             transaction id for point-in-time recovery
142           o Allow a warm standby system to also allow read-only queries
143             [pitr]
144
145             This is useful for checking PITR recovery.
146
147           o Allow the PITR process to be debugged and data examined
148
149
150 Monitoring
151 ==========
152
153 * Allow server log information to be output as INSERT statements
154
155   This would allow server log information to be easily loaded into
156   a database for analysis.
157
158 * %Add ability to monitor the use of temporary sort files
159 * Allow server logs to be remotely read and removed using SQL commands
160
161
162 Data Types
163 ==========
164
165 * Improve the MONEY data type
166
167   Change the MONEY data type to use DECIMAL internally, with special
168   locale-aware output formatting.
169
170 * Change NUMERIC to enforce the maximum precision, and increase it
171 * Add NUMERIC division operator that doesn't round?
172
173   Currently NUMERIC _rounds_ the result to the specified precision.  
174   This means division can return a result that multiplied by the 
175   divisor is greater than the dividend, e.g. this returns a value > 10:
176
177     SELECT (10::numeric(2,0) / 6::numeric(2,0))::numeric(2,0) * 6;
178
179   The positive modulus result returned by NUMERICs might be considered
180   inaccurate, in one sense.
181
182 * Have sequence dependency track use of DEFAULT sequences,
183   seqname.nextval?
184 * %Disallow changing default expression of a SERIAL column?
185 * Fix data types where equality comparison isn't intuitive, e.g. box
186 * %Prevent INET cast to CIDR if the unmasked bits are not zero, or
187   zero the bits
188 * %Prevent INET cast to CIDR from droping netmask, SELECT '1.1.1.1'::inet::cidr
189 * Allow INET + INT4 to increment the host part of the address, or
190   throw an error on overflow
191 * %Add 'tid != tid ' operator for use in corruption recovery
192
193
194 * Dates and Times
195
196         o Allow infinite dates just like infinite timestamps
197         o Add a GUC variable to allow output of interval values in ISO8601 
198           format
199         o Merge hardwired timezone names with the TZ database; allow either 
200           kind everywhere a TZ name is currently taken
201         o Allow customization of the known set of TZ names (generalize the
202           present australian_timezones hack)
203         o Allow TIMESTAMP WITH TIME ZONE to store the original timezone
204           information, either zone name or offset from UTC [timezone]
205
206           If the TIMESTAMP value is stored with a time zone name, interval 
207           computations should adjust based on the time zone rules.
208
209         o Fix SELECT '0.01 years'::interval, '0.01 months'::interval
210         o Add ISO INTERVAL handling
211                 o Add support for day-time syntax, INTERVAL '1 2:03:04' DAY TO 
212                   SECOND
213                 o Add support for year-month syntax, INTERVAL '50-6' YEAR TO MONTH
214                 o For syntax that isn't uniquely ISO or PG syntax, like '1:30' or
215                   '1', treat as ISO if there is a range specification clause,
216                   and as PG if there no clause is present, e.g. interpret 
217                           '1:30' MINUTE TO SECOND as '1 minute 30 seconds', and 
218                           interpret '1:30' as '1 hour, 30 minutes'
219                 o Interpret INTERVAL '1 year' MONTH as CAST (INTERVAL '1 year' AS
220                   INTERVAL MONTH), and this should return '12 months'
221                 o Round or truncate values to the requested precision, e.g.
222                   INTERVAL '11 months' AS YEAR should return one or zero
223                 o Support precision, CREATE TABLE foo (a INTERVAL MONTH(3))
224
225
226 * Arrays
227
228         o Allow NULLs in arrays
229         o Delay resolution of array expression's data type so assignment
230           coercion can be performed on empty array expressions
231
232
233 * Binary Data
234
235         o Improve vacuum of large objects, like /contrib/vacuumlo?
236         o Add security checking for large objects
237         o Auto-delete large objects when referencing row is deleted
238
239           /contrib/lo offers this functionality.
240
241         o Allow read/write into TOAST values like large objects
242
243           This requires the TOAST column to be stored EXTERNAL.
244
245
246 Functions
247 =========
248
249 * Allow INET subnet tests using non-constants to be indexed
250 * Add transaction_timestamp(), statement_timestamp(), clock_timestamp()
251   functionality
252
253   Current CURRENT_TIMESTAMP returns the start time of the current
254   transaction, and gettimeofday() returns the wallclock time. This will
255   make time reporting more consistent and will allow reporting of
256   the statement start time.
257
258 * %Add pg_get_acldef(), pg_get_typedefault(), and pg_get_attrdef()
259 * Allow to_char() to print localized month names
260 * Allow functions to have a schema search path specified at creation time
261 * Allow substring/replace() to get/set bit values
262 * Allow to_char() on interval values to accumulate the highest unit
263   requested
264
265   Some special format flag would be required to request such
266   accumulation.  Such functionality could also be added to EXTRACT. 
267   Prevent accumulation that crosses the month/day boundary because of
268   the uneven number of days in a month.
269
270         o to_char(INTERVAL '1 hour 5 minutes', 'MI') => 65
271         o to_char(INTERVAL '43 hours 20 minutes', 'MI' ) => 2600 
272         o to_char(INTERVAL '43 hours 20 minutes', 'WK:DD:HR:MI') => 0:1:19:20
273         o to_char(INTERVAL '3 years 5 months','MM') => 41
274
275 * Add sleep() function, remove from regress.c
276
277
278 Multi-Language Support
279 ======================
280
281 * Add NCHAR (as distinguished from ordinary varchar),
282 * Allow locale to be set at database creation
283
284   Currently locale can only be set during initdb.  No global tables have
285   locale-aware columns.  However, the database template used during
286   database creation might have locale-aware indexes.  The indexes would
287   need to be reindexed to match the new locale.
288
289 * Allow encoding on a per-column basis
290
291   Right now only one encoding is allowed per database.
292
293 * Support multiple simultaneous character sets, per SQL92
294 * Improve UTF8 combined character handling?
295 * Add octet_length_server() and octet_length_client()
296 * Make octet_length_client() the same as octet_length()?
297 * Fix problems with wrong runtime encoding conversion for NLS message files
298
299
300 Views / Rules
301 =============
302
303 * %Automatically create rules on views so they are updateable, per SQL99
304
305   We can only auto-create rules for simple views.  For more complex
306   cases users will still have to write rules.
307
308 * Add the functionality for WITH CHECK OPTION clause of CREATE VIEW
309 * Allow NOTIFY in rules involving conditionals
310 * Allow VIEW/RULE recompilation when the underlying tables change
311
312   Another issue is whether underlying table changes should be reflected
313   in the view, e.g. should SELECT * show additional columns if they
314   are added after the view is created.
315
316
317 SQL Commands
318 ============
319
320 * Change LIMIT/OFFSET and FETCH/MOVE to use int8
321 * Add CORRESPONDING BY to UNION/INTERSECT/EXCEPT
322 * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY
323 * %Allow SET CONSTRAINTS to be qualified by schema/table name
324 * %Allow TRUNCATE ... CASCADE/RESTRICT
325
326   This is like DELETE CASCADE, but truncates.
327
328 * %Add a separate TRUNCATE permission
329
330   Currently only the owner can TRUNCATE a table because triggers are not
331   called, and the table is locked in exclusive mode.
332
333 * Allow PREPARE of cursors
334 * Allow PREPARE to automatically determine parameter types based on the SQL
335   statement
336 * Allow finer control over the caching of prepared query plans
337
338   Currently, queries prepared via the libpq API are planned on first
339   execute using the supplied parameters --- allow SQL PREPARE to do the
340   same.  Also, allow control over replanning prepared queries either
341   manually or automatically when statistics for execute parameters
342   differ dramatically from those used during planning.
343
344 * Allow LISTEN/NOTIFY to store info in memory rather than tables?
345
346   Currently LISTEN/NOTIFY information is stored in pg_listener. Storing
347   such information in memory would improve performance.
348
349 * Add optional textual message to NOTIFY
350
351   This would allow an informational message to be added to the notify
352   message, perhaps indicating the row modified or other custom
353   information.
354
355 * Add a GUC variable to warn about non-standard SQL usage in queries
356 * Add MERGE command that does UPDATE/DELETE, or on failure, INSERT (rules,
357   triggers?)
358 * Add NOVICE output level for helpful messages like automatic sequence/index
359   creation
360 * %Add COMMENT ON for all cluster global objects (roles, databases
361   and tablespaces)
362 * %Make row-wise comparisons work per SQL spec
363 * Add RESET CONNECTION command to reset all session state
364
365   This would include resetting of all variables (RESET ALL), dropping of
366   temporary tables, removing any NOTIFYs, cursors, open transactions,
367   prepared queries, currval()s, etc.  This could be used  for connection
368   pooling.  We could also change RESET ALL to have this functionality.  
369   The difficult of this features is allowing RESET ALL to not affect 
370   changes made by the interface driver for its internal use.  One idea 
371   is for this to be a protocol-only feature.  Another approach is to 
372   notify the protocol when a RESET CONNECTION command is used.
373
374 * Add GUC to issue notice about queries that use unjoined tables
375 * Allow EXPLAIN to identify tables that were skipped because of 
376   constraint_exclusion
377 * Allow EXPLAIN output to be more easily processed by scripts
378
379
380 * CREATE
381
382         o Allow CREATE TABLE AS to determine column lengths for complex
383           expressions like SELECT col1 || col2
384
385         o Use more reliable method for CREATE DATABASE to get a consistent
386           copy of db?
387
388         o Add ON COMMIT capability to CREATE TABLE AS ... SELECT
389
390
391 * UPDATE
392         o Allow UPDATE to handle complex aggregates [update]?
393         o Allow an alias to be provided for the target table in
394           UPDATE/DELETE
395
396           This is not SQL-spec but many DBMSs allow it.
397
398         o Allow UPDATE tab SET ROW (col, ...) = (...) for updating multiple
399           columns
400
401
402 * ALTER
403
404         o %Have ALTER TABLE RENAME rename SERIAL sequence names
405         o Add ALTER DOMAIN to modify the underlying data type
406         o %Allow ALTER TABLE ... ALTER CONSTRAINT ... RENAME
407         o %Allow ALTER TABLE to change constraint deferrability and actions
408         o Add missing object types for ALTER ... SET SCHEMA
409         o Allow ALTER TABLESPACE to move to different directories
410         o Allow databases to be moved to different tablespaces
411         o Allow moving system tables to other tablespaces, where possible
412
413           Currently non-global system tables must be in the default database
414           tablespace. Global system tables can never be moved.
415
416         o %Disallow dropping of an inherited constraint
417         o %Prevent child tables from altering or dropping constraints 
418           like CHECK that were inherited from the parent table
419
420
421 * CLUSTER
422
423         o Automatically maintain clustering on a table
424
425           This might require some background daemon to maintain clustering
426           during periods of low usage. It might also require tables to be only
427           paritally filled for easier reorganization.  Another idea would
428           be to create a merged heap/index data file so an index lookup would
429           automatically access the heap data too.  A third idea would be to
430           store heap rows in hashed groups, perhaps using a user-supplied
431           hash function.
432
433         o %Add default clustering to system tables
434
435           To do this, determine the ideal cluster index for each system
436           table and set the cluster setting during initdb.
437
438
439 * COPY
440
441         o Allow COPY to report error lines and continue
442
443           This requires the use of a savepoint before each COPY line is
444           processed, with ROLLBACK on COPY failure.
445
446         o %Have COPY return the number of rows loaded/unloaded?
447
448
449 * GRANT/REVOKE
450
451         o Allow column-level privileges
452         o %Allow GRANT/REVOKE permissions to be applied to all schema objects
453           with one command
454
455           The proposed syntax is:
456                 GRANT SELECT ON ALL TABLES IN public TO phpuser;
457                 GRANT SELECT ON NEW TABLES IN public TO phpuser;
458
459         * Allow GRANT/REVOKE permissions to be inherited by objects based on
460           schema permissions
461
462
463 * CURSOR
464
465         o Allow UPDATE/DELETE WHERE CURRENT OF cursor
466
467           This requires using the row ctid to map cursor rows back to the
468           original heap row. This become more complicated if WITH HOLD cursors
469           are to be supported because WITH HOLD cursors have a copy of the row
470           and no FOR UPDATE lock.
471
472         o Prevent DROP TABLE from dropping a row referenced by its own open
473           cursor?
474
475         o %Allow pooled connections to list all open WITH HOLD cursors
476
477           Because WITH HOLD cursors exist outside transactions, this allows
478           them to be listed so they can be closed.
479
480
481 * INSERT
482
483         o Allow INSERT/UPDATE of the system-generated oid value for a row
484         o Allow INSERT INTO tab (col1, ..) VALUES (val1, ..), (val2, ..)
485         o Allow INSERT/UPDATE ... RETURNING new.col or old.col
486
487           This is useful for returning the auto-generated key for an INSERT.
488           One complication is how to handle rules that run as part of
489           the insert.
490
491
492 * SHOW/SET
493
494         o Add SET PERFORMANCE_TIPS option to suggest INDEX, VACUUM, VACUUM
495           ANALYZE, and CLUSTER
496         o Add SET PATH for schemas?
497
498           This is basically the same as SET search_path.
499
500
501 * Server-Side Languages
502
503         o Fix PL/pgSQL RENAME to work on variables other than OLD/NEW
504         o Allow function parameters to be passed by name,
505           get_employee_salary(emp_id => 12345, tax_year => 2001)
506         o Add Oracle-style packages
507         o Add table function support to pltcl, plpython
508         o Add capability to create and call PROCEDURES
509         o Allow PL/pgSQL to handle %TYPE arrays, e.g. tab.col%TYPE[]
510         o Allow function argument names to be queries from PL/PgSQL
511         o Add MOVE to PL/pgSQL
512         o Add support for polymorphic arguments and return types to
513           languages other than PL/PgSQL
514         o Add support for OUT and INOUT parameters to languages other 
515           than PL/PgSQL
516
517
518 Clients
519 =======
520
521 * Add a libpq function to support Parse/DescribeStatement capability
522 * Prevent libpq's PQfnumber() from lowercasing the column name?
523 * Add PQescapeIdentifier() to libpq
524 * Have initdb set the input DateStyle (MDY or DMY) based on locale?
525 * Have pg_ctl look at PGHOST in case it is a socket directory?
526 * Allow pg_ctl to work properly with configuration files located outside
527   the PGDATA directory
528
529   pg_ctl can not read the pid file because it isn't located in the
530   config directory but in the PGDATA directory.  The solution is to
531   allow pg_ctl to read and understand postgresql.conf to find the
532   data_directory value.
533
534
535 * psql
536
537         o Have psql show current values for a sequence
538         o Move psql backslash database information into the backend, use
539           mnemonic commands? [psql]
540
541           This would allow non-psql clients to pull the same information out
542           of the database as psql.
543
544         o Fix psql's display of schema information (Neil)
545         o Allow psql \pset boolean variables to set to fixed values, rather
546           than toggle
547         o Consistently display privilege information for all objects in psql
548         o Improve psql's handling of multi-line queries
549
550           Currently, while \e saves a single query as one entry, interactive
551           queries are saved one line at a time.  Ideally all queries
552           whould be saved like \e does.
553
554         o Allow multi-line column values to align in the proper columns
555
556           If the second output column value is 'a\nb', the 'b' should appear
557           in the second display column, rather than the first column as it
558           does now.
559
560
561 * pg_dump
562
563         o %Have pg_dump use multi-statement transactions for INSERT dumps
564         o %Allow pg_dump to use multiple -t and -n switches [pg_dump]
565         o %Add dumping of comments on composite type columns
566         o %Add dumping of comments on index columns
567         o %Replace crude DELETE FROM method of pg_dumpall --clean for 
568           cleaning of roles with separate DROP commands
569         o Stop dumping CASCADE on DROP TYPE commands in clean mode
570         o %Add full object name to the tag field.  eg. for operators we need
571           '=(integer, integer)', instead of just '='.
572         o Add pg_dumpall custom format dumps?
573         o %Add CSV output format
574         o Update pg_dump and psql to use the new COPY libpq API (Christopher)
575         o Remove unnecessary function pointer abstractions in pg_dump source
576           code
577
578
579 * ecpg
580
581         o Docs
582
583           Document differences between ecpg and the SQL standard and
584           information about the Informix-compatibility module.
585
586         o Solve cardinality > 1 for input descriptors / variables?
587         o Add a semantic check level, e.g. check if a table really exists
588         o fix handling of DB attributes that are arrays
589         o Use backend PREPARE/EXECUTE facility for ecpg where possible
590         o Implement SQLDA
591         o Fix nested C comments
592         o %sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified
593         o Make SET CONNECTION thread-aware, non-standard?
594         o Allow multidimensional arrays
595         o Add internationalized message strings
596
597
598 Referential Integrity
599 =====================
600
601 * Add MATCH PARTIAL referential integrity
602 * Add deferred trigger queue file
603
604   Right now all deferred trigger information is stored in backend
605   memory.  This could exhaust memory for very large trigger queues.
606   This item involves dumping large queues into files.
607
608 * Change foreign key constraint for array -> element to mean element
609   in array?
610 * Allow DEFERRABLE UNIQUE constraints?
611 * Allow triggers to be disabled in only the current session.
612
613   This is currently possible by starting a multi-statement transaction,
614   modifying the system tables, performing the desired SQL, restoring the
615   system tables, and committing the transaction.  ALTER TABLE ...
616   TRIGGER requires a table lock so it is not ideal for this usage.
617
618 * With disabled triggers, allow pg_dump to use ALTER TABLE ADD FOREIGN KEY
619
620   If the dump is known to be valid, allow foreign keys to be added
621   without revalidating the data.
622
623 * Allow statement-level triggers to access modified rows
624 * Support triggers on columns (Greg Sabino Mullane)
625 * Enforce referential integrity for system tables
626 * Allow AFTER triggers on system tables
627
628   System tables are modified in many places in the backend without going
629   through the executor and therefore not causing triggers to fire. To
630   complete this item, the functions that modify system tables will have
631   to fire triggers.
632
633
634 Dependency Checking
635 ===================
636
637 * Flush cached query plans when the dependent objects change
638 * Track dependencies in function bodies and recompile/invalidate
639
640   This is particularly important for references to temporary tables
641   in PL/PgSQL because PL/PgSQL caches query plans.  The only workaround
642   in PL/PgSQL is to use EXECUTE.  One complexity is that a function
643   might itself drop and recreate dependent tables, causing it to
644   invalidate its own query plan.
645
646
647 Exotic Features
648 ===============
649
650 * Add SQL99 WITH clause to SELECT
651 * Add SQL99 WITH RECURSIVE to SELECT
652 * Add pre-parsing phase that converts non-ISO syntax to supported
653   syntax
654
655   This could allow SQL written for other databases to run without
656   modification.
657
658 * Allow plug-in modules to emulate features from other databases
659 * SQL*Net listener that makes PostgreSQL appear as an Oracle database
660   to clients
661 * Allow queries across databases or servers with transaction
662   semantics
663
664   This can be done using dblink and two-phase commit.
665
666 * Add the features of packages
667
668         o  Make private objects accessable only to objects in the same schema
669         o  Allow current_schema.objname to access current schema objects
670         o  Add session variables
671         o  Allow nested schemas
672
673
674 Indexes
675 =======
676
677 * Allow inherited tables to inherit index, UNIQUE constraint, and primary
678   key, foreign key
679 * UNIQUE INDEX on base column not honored on INSERTs/UPDATEs from
680   inherited table:  INSERT INTO inherit_table (unique_index_col) VALUES
681   (dup) should fail
682
683   The main difficulty with this item is the problem of creating an index
684   that can span more than one table.
685
686 * Allow SELECT ... FOR UPDATE on inherited tables
687 * Add UNIQUE capability to non-btree indexes
688 * Prevent index uniqueness checks when UPDATE does not modify the column
689
690   Uniqueness (index) checks are done when updating a column even if the
691   column is not modified by the UPDATE.
692
693 * Allow the creation of on-disk bitmap indexes which can be quickly
694   combined with other bitmap indexes
695
696   Such indexes could be more compact if there are only a few distinct values.
697   Such indexes can also be compressed.  Keeping such indexes updated can be
698   costly.
699
700 * Allow use of indexes to search for NULLs
701
702   One solution is to create a partial index on an IS NULL expression.
703
704 * Allow accurate statistics to be collected on indexes with more than
705   one column or expression indexes, perhaps using per-index statistics
706 * Add fillfactor to control reserved free space during index creation
707 * Allow the creation of indexes with mixed ascending/descending specifiers
708 * Allow constraint_exclusion to work for UNIONs like it does for
709   inheritance, allow it to work for UPDATE and DELETE queries, and allow
710   it to be used for all queries with little performance impact
711
712
713 * GIST
714
715         o Add more GIST index support for geometric data types
716         o Allow GIST indexes to create certain complex index types, like
717           digital trees (see Aoki)
718
719 * Hash
720
721         o Pack hash index buckets onto disk pages more efficiently
722
723           Currently only one hash bucket can be stored on a page. Ideally
724           several hash buckets could be stored on a single page and greater
725           granularity used for the hash algorithm.
726
727         o Consider sorting hash buckets so entries can be found using a
728           binary search, rather than a linear scan
729
730         o In hash indexes, consider storing the hash value with or instead
731           of the key itself
732
733         o Add WAL logging for crash recovery
734         o Allow multi-column hash indexes
735
736
737 Fsync
738 =====
739
740 * Improve commit_delay handling to reduce fsync()
741 * Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
742
743   Ideally this requires a separate test program that can be run
744   at initdb time or optionally later.
745
746 * %Add an option to sync() before fsync()'ing checkpoint files
747 * Add program to test if fsync has a delay compared to non-fsync
748
749
750 Cache Usage
751 ===========
752
753 * Allow free-behind capability for large sequential scans, perhaps using
754   posix_fadvise()
755
756   Posix_fadvise() can control both sequential/random file caching and
757   free-behind behavior, but it is unclear how the setting affects other
758   backends that also have the file open, and the feature is not supported
759   on all operating systems.
760
761 * Speed up COUNT(*)
762
763   We could use a fixed row count and a +/- count to follow MVCC
764   visibility rules, or a single cached value could be used and
765   invalidated if anyone modifies the table.  Another idea is to
766   get a count directly from a unique index, but for this to be
767   faster than a sequential scan it must avoid access to the heap
768   to obtain tuple visibility information.
769
770 * Allow data to be pulled directly from indexes
771
772   Currently indexes do not have enough tuple visibility information 
773   to allow data to be pulled from the index without also accessing 
774   the heap.  One way to allow this is to set a bit to index tuples 
775   to indicate if a tuple is currently visible to all transactions 
776   when the first valid heap lookup happens.  This bit would have to 
777   be cleared when a heap tuple is expired.
778
779
780 * Consider automatic caching of queries at various levels:
781
782         o Parsed query tree
783         o Query execute plan
784         o Query results
785
786 * Allow sequential scans to take advantage of other concurrent
787   sequentiqal scans, also called "Synchronised Scanning"
788
789   One possible implementation is to start sequential scans from the lowest
790   numbered buffer in the shared cache, and when reaching the end wrap
791   around to the beginning, rather than always starting sequential scans
792   at the start of the table.
793
794
795 Vacuum
796 ======
797
798 * Improve speed with indexes
799
800   For large table adjustements during VACUUM FULL, it is faster to 
801   reindex rather than update the index.
802
803 * Reduce lock time during VACUUM FULL by moving tuples with read lock,
804   then write lock and truncate table
805
806   Moved tuples are invisible to other backends so they don't require a
807   write lock. However, the read lock promotion to write lock could lead
808   to deadlock situations.
809
810 * Maintain a map of recently-expired rows
811
812   This allows vacuum to target specific pages for possible free space 
813   without requiring a sequential scan.
814
815 * Auto-fill the free space map by scanning the buffer cache or by
816   checking pages written by the background writer
817 * Create a bitmap of pages that need vacuuming
818
819   Instead of sequentially scanning the entire table, have the background
820   writer or some other process record pages that have expired rows, then
821   VACUUM can look at just those pages rather than the entire table.  In
822   the event of a system crash, the bitmap would probably be invalidated.
823
824 * %Add system view to show free space map contents
825
826
827 * Auto-vacuum
828
829         o Use free-space map information to guide refilling
830         o %Issue log message to suggest VACUUM FULL if a table is nearly
831           empty?
832         o Improve xid wraparound detection by recording per-table rather
833           than per-database
834
835
836 Locking
837 =======
838
839 * Add code to detect an SMP machine and handle spinlocks accordingly
840   from distributted.net, http://www1.distributed.net/source,
841   in client/common/cpucheck.cpp
842
843   On SMP machines, it is possible that locks might be released shortly,
844   while on non-SMP machines, the backend should sleep so the process
845   holding the lock can complete and release it.
846
847 * Research use of sched_yield() for spinlock acquisition failure
848 * Fix priority ordering of read and write light-weight locks (Neil)
849
850
851 Startup Time Improvements
852 =========================
853
854 * Experiment with multi-threaded backend [thread]
855
856   This would prevent the overhead associated with process creation. Most
857   operating systems have trivial process creation time compared to
858   database startup overhead, but a few operating systems (WIn32,
859   Solaris) might benefit from threading.  Also explore the idea of
860   a single session using multiple threads to execute a query faster.
861
862 * Add connection pooling
863
864   It is unclear if this should be done inside the backend code or done
865   by something external like pgpool. The passing of file descriptors to
866   existing backends is one of the difficulties with a backend approach.
867
868
869 Write-Ahead Log
870 ===============
871
872 * Eliminate need to write full pages to WAL before page modification [wal]
873
874   Currently, to protect against partial disk page writes, we write
875   full page images to WAL before they are modified so we can correct any
876   partial page writes during recovery.  These pages can also be
877   eliminated from point-in-time archive files.
878
879         o  When off, write CRC to WAL and check file system blocks
880            on recovery
881
882            If CRC check fails during recovery, remember the page in case
883            a later CRC for that page properly matches.
884
885         o  Write full pages during file system write and not when
886            the page is modified in the buffer cache
887
888            This allows most full page writes to happen in the background
889            writer.  It might cause problems for applying WAL on recovery
890            into a partially-written page, but later the full page will be
891            replaced from WAL.
892
893 * Reduce WAL traffic so only modified values are written rather than
894   entire rows?
895 * Allow the pg_xlog directory location to be specified during initdb
896   with a symlink back to the /data location
897 * Allow WAL information to recover corrupted pg_controldata
898 * Find a way to reduce rotational delay when repeatedly writing
899   last WAL page
900
901   Currently fsync of WAL requires the disk platter to perform a full
902   rotation to fsync again. One idea is to write the WAL to different
903   offsets that might reduce the rotational delay.
904
905 * Allow buffered WAL writes and fsync
906
907   Instead of guaranteeing recovery of all committed transactions, this
908   would provide improved performance by delaying WAL writes and fsync
909   so an abrupt operating system restart might lose a few seconds of
910   committed transactions but still be consistent.  We could perhaps
911   remove the 'fsync' parameter (which results in an an inconsistent
912   database) in favor of this capability.
913
914
915 Optimizer / Executor
916 ====================
917
918 * Add missing optimizer selectivities for date, r-tree, etc
919 * Allow ORDER BY ... LIMIT # to select high/low value without sort or
920   index using a sequential scan for highest/lowest values
921
922   Right now, if no index exists, ORDER BY ... LIMIT # requires we sort
923   all values to return the high/low value.  Instead The idea is to do a 
924   sequential scan to find the high/low value, thus avoiding the sort.
925   MIN/MAX already does this, but not for LIMIT > 1.
926
927 * Precompile SQL functions to avoid overhead
928 * Create utility to compute accurate random_page_cost value
929 * Improve ability to display optimizer analysis using OPTIMIZER_DEBUG
930 * Have EXPLAIN ANALYZE highlight poor optimizer estimates
931 * Consider using hash buckets to do DISTINCT, rather than sorting
932
933   This would be beneficial when there are few distinct values.
934
935 * Log queries where the optimizer row estimates were dramatically
936   different from the number of rows actually found?
937
938
939 Miscellaneous Performance
940 =========================
941
942 * Do async I/O for faster random read-ahead of data
943
944   Async I/O allows multiple I/O requests to be sent to the disk with
945   results coming back asynchronously.
946
947 * Use mmap() rather than SYSV shared memory or to write WAL files?
948
949   This would remove the requirement for SYSV SHM but would introduce
950   portability issues. Anonymous mmap (or mmap to /dev/zero) is required
951   to prevent I/O overhead.
952
953 * Consider mmap()'ing files into a backend?
954
955   Doing I/O to large tables would consume a lot of address space or
956   require frequent mapping/unmapping.  Extending the file also causes
957   mapping problems that might require mapping only individual pages,
958   leading to thousands of mappings.  Another problem is that there is no
959   way to _prevent_ I/O to disk from the dirty shared buffers so changes
960   could hit disk before WAL is written.
961
962 * Add a script to ask system configuration questions and tune postgresql.conf
963 * Use a phantom command counter for nested subtransactions to reduce
964   per-tuple overhead
965 * Research storing disk pages with no alignment/padding
966
967 Source Code
968 ===========
969
970 * Add use of 'const' for variables in source tree
971 * Rename some /contrib modules from pg* to pg_*
972 * Move some things from /contrib into main tree
973 * Move some /contrib modules out to their own project sites
974 * %Remove warnings created by -Wcast-align
975 * Move platform-specific ps status display info from ps_status.c to ports
976 * Add optional CRC checksum to heap and index pages
977 * Improve documentation to build only interfaces (Marc)
978 * Remove or relicense modules that are not under the BSD license, if possible
979 * %Remove memory/file descriptor freeing before ereport(ERROR)
980 * Acquire lock on a relation before building a relcache entry for it
981 * %Promote debug_query_string into a server-side function current_query()
982 * %Allow the identifier length to be increased via a configure option
983 * Remove Win32 rename/unlink looping if unnecessary
984 * Allow cross-compiling by generating the zic database on the target system
985 * Improve NLS maintenace of libpgport messages linked onto applications
986 * Allow ecpg to work with MSVC and BCC
987 * Add xpath_array() to /contrib/xml2 to return results as an array
988 * Allow building in directories containing spaces
989
990   This is probably not possible because 'gmake' and other compiler tools
991   do not fully support quoting of paths with spaces.
992
993 * Allow installing to directories containing spaces
994
995   This is possible if proper quoting is added to the makefiles for the
996   install targets.  Because PostgreSQL supports relocatable installs, it
997   is already possible to install into a directory that doesn't contain 
998   spaces and then copy the install to a directory with spaces.
999
1000 * Fix sgmltools so PDFs can be generated with bookmarks
1001 * %Clean up compiler warnings (especially with gcc version 4)
1002
1003
1004 * Win32
1005
1006         o Remove configure.in check for link failure when cause is found
1007         o Remove readdir() errno patch when runtime/mingwex/dirent.c rev
1008           1.4 is released
1009         o Remove psql newline patch when we find out why mingw outputs an
1010           extra newline
1011         o Allow psql to use readline once non-US code pages work with
1012           backslashes
1013         o Re-enable timezone output on log_line_prefix '%t' when a
1014           shorter timezone string is available
1015         o Fix problem with shared memory on the Win32 Terminal Server
1016         o %Add support for Unicode
1017
1018           To fix this, the data needs to be converted to/from UTF16/UTF8
1019           so the Win32 wcscoll() can be used, and perhaps other functions
1020           like towupper().  However, UTF8 already works with normal
1021           locales but provides no ordering or character set classes.
1022
1023
1024 * Wire Protocol Changes
1025
1026         o Allow dynamic character set handling
1027         o Add decoded type, length, precision
1028         o Use compression?
1029         o Update clients to use data types, typmod, schema.table.column names
1030           of result sets using new query protocol
1031
1032
1033 ---------------------------------------------------------------------------
1034
1035
1036 Developers who have claimed items are:
1037 --------------------------------------
1038 * Alvaro is Alvaro Herrera <alvherre@dcc.uchile.cl>
1039 * Andrew is Andrew Dunstan <andrew@dunslane.net>
1040 * Bruce is Bruce Momjian <pgman@candle.pha.pa.us> of Software Research Assoc.
1041 * Christopher is Christopher Kings-Lynne <chriskl@familyhealth.com.au> of
1042     Family Health Network
1043 * Claudio is Claudio Natoli <claudio.natoli@memetrics.com>
1044 * D'Arcy is D'Arcy J.M. Cain <darcy@druid.net> of The Cain Gang Ltd.
1045 * Fabien is Fabien Coelho <coelho@cri.ensmp.fr>
1046 * Gavin is Gavin Sherry <swm@linuxworld.com.au> of Alcove Systems Engineering
1047 * Greg is Greg Sabino Mullane <greg@turnstep.com>
1048 * Hiroshi is Hiroshi Inoue <Inoue@tpf.co.jp>
1049 * Jan is Jan Wieck <JanWieck@Yahoo.com> of Afilias, Inc.
1050 * Joe is Joe Conway <mail@joeconway.com>
1051 * Karel is Karel Zak <zakkr@zf.jcu.cz>
1052 * Magnus is Magnus Hagander <mha@sollentuna.net>
1053 * Marc is Marc Fournier <scrappy@hub.org> of PostgreSQL, Inc.
1054 * Matthew T. O'Connor <matthew@zeut.net>
1055 * Michael is Michael Meskes <meskes@postgresql.org> of Credativ
1056 * Neil is Neil Conway <neilc@samurai.com>
1057 * Oleg is Oleg Bartunov <oleg@sai.msu.su>
1058 * Peter is Peter Eisentraut <peter_e@gmx.net>
1059 * Philip is Philip Warner <pjw@rhyme.com.au> of Albatross Consulting Pty. Ltd.
1060 * Rod is Rod Taylor <pg@rbt.ca>
1061 * Simon is Simon Riggs <simon@2ndquadrant.com>
1062 * Stephan is Stephan Szabo <sszabo@megazone23.bigpanda.com>
1063 * Tatsuo is Tatsuo Ishii <t-ishii@sra.co.jp> of Software Research Assoc.
1064 * Tom is Tom Lane <tgl@sss.pgh.pa.us> of Red Hat